gets vs scanf for str
#include <stdio.h>
int main() {
// Write C code here
char str[34];
printf(" Enter your name : ");
gets(str);
printf("You name is %s",str);
}
//YOU WILL GET MULTI-STRINGS .IE , SPACES BETWEEN NAMES TOO
//*****************
#include <stdio.h>
int main() {
// Write C code here
char str[34];
printf(" Enter your name : ");
scanf("%s",str);
printf("You name is %s",str);
}
//ONLY PRINTS 1ST NAME
Comments
Post a Comment