0

I've been trying many different variations of "%[^\n]" to make my code work so that it can read spaces but none has work so far.

void details(Person *persondetails){

    printf("Enter your name: ");
    scanf("%[^\n]", persondetails->name);

    printf("Enter your phone number: ");
    scanf("%s", persondetails->phoneNum);
}

This is the output:

Enter your name: Enter your phone number: 

Expected output would obviously be if I were use to "%s" like normal. Would love some help.

John Kugelman
  • 330,190
  • 66
  • 504
  • 555

0 Answers0