What does the following code do when the input is 56789 1234 45a72
int i;
float f;
char name[50];
scanf("%2 %f %*d %2s",&i,&f1,&name);
When I ran the code in the compiler and used printf to check the results i got
56 789.000000 45a72
I understand that it didn't 1234 because it was optional and no varaible is declared for it, but for scanning %2s isn't suppose to return the first 2 characters of the string which are 45 I don't understand why it is returning the whole string?
Any help is appreciated
Thanks