i'm trying to read strings (no more than 100 characters long) from stdin and store them in an array of strings... so what am i doing wrong here?
#include <stdio.h>
#include <string.h>
int main(){
int i, counter;
scanf("%d", &counter);
char *strArr[counter][100];
for(i=0; i<counter; i++){
char str[100];
scanf("%s", str);
strcpy(strArr[100], str);
}
for(i=0; i<counter; i++)
printf("%s\n", strArr[100]);
return 0;
}
#include <stdio.h>
#include <string.h>
int main(){
int i, counter;
scanf("%d", &counter);
char *strArr[counter][100];
for(i=0; i<counter; i++){
char str[100];
scanf("%s", str);
strcpy(strArr[100], str);
}
for(i=0; i<counter; i++)
printf("%s\n", strArr[100]);
return 0;
}