using scanf function with pointers to character

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 the keyboard.

int main() {
  char arrays[12];
  char *pointers = arrays;
  scanf("%s", pointers);
  printf("%s", pointers);
  return 0;
}

Leave a Comment