I don't know exactly what the question is. I'll give you a rough example.
#include <string.h>
void fill_string(char buf[3][100])
{
char default_string[3][100] = { "apple", "bee", "carrot" };
int i = 0;
for(i = 0; i < 3; i++)
{
strcpy(buf[i], default_string[i]);
}
}
int main()
{
char s[3][100] = {0,};
int i;
fill_string(s);
for(i = 0; i < 3; i++)
{
printf("%s\n", s[i]);
}
return 0;
}
© 2024 OneMinuteCode. All rights reserved.