important: I don't have a deep understanding of malloc so try to put things as simple as possible Greetings, I want to create a dynamic array of strings (using malloc) and then print those strings out (for starters).
That's what I have
int main(){
char **namesofcolumns = malloc(4 * sizeof(char*));
for(int i = 0; i < 4; i++){
namesofcolumns[i] = malloc(20 * sizeof(char));
}
int count = 1;
for(int i = 0; i < 4; i++){
printf("Enter %d column name\n", count);
scanf("%s", namesofcolumns[i]);
count++;
}
I probably have errors here already. How do I print entered strings out?
char*. Ask yourself what the types are ofnamesofcolumnsandnamesofcolumns[i]