void doSmth(char **ar, int lines) {
ar= (char*) malloc(sizeof(char*) * lines);
for (int i = 0; i < lines; i++) {
ar[i] = (char*) malloc(200 + 1);
for (int j = 0; ar[i][j] != '\0'; j++) {
printf("%c", ar[i][j]);
}
free(ar[i]);
}
free(ar);
}
This code seems right to me but nothing happens. There is no error whatsoever. I've tried other ways to iterate over array other than != '/0' part.
Note: The 200 is because a single line cannot be longer than 200 chars long per program requirements.