Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
2-D array
//Title of this code //gcc 4.9.1 #include <stdio.h> struct test{ int i; double d; }; void initfield(struct test *a, int structsize) { int i, j; for (i = 0; i < structsize; i++) { for (j = 0; j < structsize; j++) { ((a+(i*structsize))+j)->i = 7; ((a+(i*structsize))+j)->d = 2.0; } } } int main(void) { int i, j; struct test field[8][8]; initfield(field, 8); for (i = 0; i < 8; i++) { for (j = 0; j < 8; j++) { printf("test[%i][%i].i = %i\t", i, j, field[i][j].i); printf("test[%i][%i].d = %f\n", i, j, field[i][j].d); } } return 0; }
run
|
edit
|
history
|
help
0
Greeting
C_141210_Funciones
asasas
Lab 10 v1
union behaviour when const obj created
Stub Program for Problem 2 HW 2
intro coding hello world
MatrixMul_shortxshort
ultimo cuestionario
a weird way to print hello, world! hmm...