I have two methods - one for getting input for a string array and the other for printing the array. It's for an assignment for school so I can't change the methods signiture.
When the input is something like:
#define TOTAL 5
int Get(char** StrArr,int total);
void Display(char** StrArr,int size);
//Get TOTAL dynamic strings from user
if (!Get(Strings,TOTAL)) exit(0);
//display the array of strings
printf("\n\nAfter input, ");
int Get(char** StrArr,int total)
int i, result = 0;;
printf("string %i:\t", i+1);
result = 1;
void Display(char** StrArr,int size)
printf("The strings are:\n");
printf("StrArr is: %p", StrArr+i);
everything works as expected. When its something more complicated like:
The array doesn't print like it should.
It shows the first string as "aaaabb" and the third as "ccccf".
What's wrong with my code