I have written the following piece of code.
int main(){
char arrays[12];
char *pointers;
scanf("%s",arrays);
scanf("%s",pointers);
printf("%s",arrays);
printf("%s",pointers);
return 0;
}
Why does it give an error when I write `scanf("%s",pointers)?
char *pointers;
must be initialized.You can not scan string into pointers
until you point it to some address. The computer needs to know where to store the value it reads from key board.
int main(){
char arrays[12];
char *pointers= arrays;
scanf("%s",pointers);
printf("%s",pointers);
return 0;
}