1

[SOLVED] scanf and sscanf difference

view story
linux-howto

http://www.linuxquestions.org – I'm wondering if someone can explain why I have to hit ENTER twice if using the scanf() code line, but only once when using sscanf()code line in the following code. Code: #include <stdio.h> #include <string.h> int main(void) { char phone[13]; printf("Enter phone number for worker\n"); fgets(phone, sizeof(phone), stdin); scanf("%s", &phone); //sscanf(phone,"%s", &phone); printf("phone# is %s\n", phone); return 0; } I don't see anything in MAN that describes this different action. (HowTos)