I've read everything about this and still i haven't figured out how to do this. I'm trying to read a .txt line by line and put that in an array. I think my code kinda works but when i try to print the array it doesn't let me.
#include<stdio.h>
#include<stdlib.h>
#include<omp.h>
int main(){
char s[20],*list[196][20];
int i;
FILE *lista;
lista=fopen("lista.txt","r");
i=0;
while(feof==0){
getline(list[i],0,lista);
i=i+1;
printf("%s\n",list[i]);
}
for(i=0;i<195;i++){
//printf("%s\n",list[i]);
}
fclose(lista);
}
Reason why is there 2 prints is because i tried both ways to see if i could fix it. Any idea on what am i doing wrong? The error i get is "format '%s' expects argument of type 'char *' but argument 2 has type 'char**'