What is thr proper way to have an array of strings w/o having to deal with malloc and such.. i've tried several varients.. include these which all segfault..
Code:
char *randusername()
{
char *names[2][12] = { {"ltorvalds"}, {"foobar"} };
return names[0][0];
}
char *randusername()
{
char *names[2][12] = { {"ltorvalds"}, {"foobar"} };
return names[0];
}
char *randusername()
{
char *names[2][12] = { "ltorvalds", "foobar" };
return names[0][0];
}
char *randusername()
{
char *names[2][12] = { "ltorvalds", "foobar" };
return names[0];
}
what is the correct way to do this..
Thanks..