ok
input via file
**
2 2
Hi there
my name
**
2 and 2 is the numbers that signify 2 rows. 2 columns
Code:
char **c2names;
int amount_of_lines, words;
fscanf("%d %d", &amount_of_lines, &words);
c2names = (char **) malloc(amount_of_lines * sizeof(char *));
for(i = 0; i < amount_of_lines; i++)
{
c2names[i] =(char *) malloc(30 * sizeof(char));
}
int i;
for(i = 0; i < amount_of_lines; i++)
{
fscanf(fptr, "%s %s", c2names[i]);
}
is no output it should just store the hi there in one row of array and my name in second row where each word gets its own element
making each word accessable through array calling.
Now the question is do I use the int words in any of the malloc and am If I could access each element in fscanf am I doing it correctly.