Strings in C

Joined
Sep 24, 2010
Messages
2
Reaction score
0
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];
}
 
Last edited:

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top