IT STUDENT
Would you like to react to this message? Create an account in a few clicks or log in to continue.

You are not connected. Please login or register

Arrays in C

Go down  Message [Page 1 of 1]

1Arrays in C Empty Arrays in C Thu Oct 24, 2013 11:10 am

Admin


Admin

#include <stdio.h>

int main()
{
int x;
int y;
int array[8][8]; /* Declares an array like a chessboard */

for ( x = 0; x < 8; x++ ) {
for ( y = 0; y < 8; y++ )
array[x][y] = x * y; /* Set each element to a value */
}
printf( "Array Indices:\n" );
for ( x = 0; x < 8;x++ ) {
for ( y = 0; y < 8; y++ )
{
printf( "[%d][%d]=%d", x, y, array[x][y] );
}
printf( "\n" );
}
getch();
}

https://itstudent-pnv.board-directory.net

Back to top  Message [Page 1 of 1]

Permissions in this forum:
You cannot reply to topics in this forum