hey guys i m having bit trouble with multi and int array i m trying to make a program that you put ur name 3 times then it store it then when u want to output it output all 3
Code:
#include <stdio.h>
int main(void)
{
char array[10][3];
int i;
for(;;)
{
if(++i==3)
break;
fputs("Please enter your name: ",stdout);
fgets(array[i],10,stdin);
printf("Name of array %d is %s",i,array[i+1]);
}
return 0;
}
this code crashes
i made also other one
Code:
#include <stdio.h>
int main(void)
{
char array[10][3];
int i;
for(i=0;i<=3;i++)
{
fputs("Please enter your name: ",stdout);
fgets(array[i],10,stdin);
printf("Name of array %d is %s",i,array[i+1]);
}
return 0;
}
i know how to use arrays for repeadtable tasks like 1 to 10 and doing functions with them
but if i wanna store
value in array i dunt quite understand
thanks alot for your help in advanced
and merry christmas.