Hello, I'm new to C programming and C. I would appreciate it if some one could tell me what i'm doing wrong with this string.
//Declaration of 2D Array; 5 names and 40 chars in length
char stringarray[5][40];
//Function call; loop 5 times; in main
for(i=0; i<5; i++)
{
stringarray = get_name();
}
//returns string(name) to main function
char get_name()
{
char temp[512];
printf("Enter name: ");
scanf("%s", temp);
return temp[512];
}
//Declaration of 2D Array; 5 names and 40 chars in length
char stringarray[5][40];
//Function call; loop 5 times; in main
for(i=0; i<5; i++)
{
stringarray = get_name();
}
//returns string(name) to main function
char get_name()
{
char temp[512];
printf("Enter name: ");
scanf("%s", temp);
return temp[512];
}
Last edited: