This gives you an array of 50 arrays of 30 characters. But if the maximum length of each name is 30 and the expected length is considerably less, you might be better off with dynamic allocation:
#define N 50
#define MAX_LENGTH 31
char *names[N];
Then for each new name, you use a buffer of length MAX_LENGTH to read the name, and malloc to simulate arrays that are "just big enough" for each name on an idividual basis:
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.