Functions that return strings? (help)
I'm currently trying to make a program that gets the name of 4 different people, but a function gets the names and returns them... Well, that's where I'm stumped. I'm pretty sure I have to use a global pointer and some how pass the address and recieve the value???
here's the structure I'm using to hold the name (and other info):
Code:
struct stats
{
char name[12]; //person's name in string.
};
Then, I have this in the main function to get the names:
Code:
stats member[NUMBER_OF_MEMBERS]; //declaration
for (i = 0; i <= NUMBER_OF_MEMBERS; i++)
member[i].name = getName(i); //function call...
NUMBER_OF_MEMBERS is defined under the include statements as 3. Also, the program does more, but I've simplified it for posting purposes.
So, how do you use a function to return a string? I've searched the boards and online.. but it's hard to search when you have such a specific question... :)
Oh yeah, while I'm posting, how do you fill the background of the screen with one color? I know how to fill the background of a character with a color, but not the whole screen... Do I just have to use a loop and fill the screen with "\t"'s to fill it???
Thanks.