Use '%s', eg:
char name[64];
scanf ("%s", name);
Chat with our AI personalities
scanf is a function (available in C and C++)cin is an istream object (C++ only)Advice: when in doubt, use fgets+sscanf
Hiii,scanf() is an predefined function of C to getting runtime input from the user.Syntax:-scanf("sequence specifier",&variable_name);example:-#includevoid main(){int number;printf("\n Enter any number"); //message to userscanf("%d",&number); //getting input from userprintf("\n entered number is %d",number); // displaygetch();}
Usually by using the scanf function
The scanf() function in the <stdio.h> C standard library header.
The Standard Librarary Function in C is printf,scanf inf Standard input output header.. which is stdio.h.