Hi all
I'm wondering if some one could help me with something as i think i've just forgotten everything i knew :)
I have this code:
#include <stdio.h>
#include <stdlib.h>
int main()
{
char A[4];
char B[2];
char C[2];
printf("Enter Numbers: ");
scanf("%s",&A);
fflush(stdin);
printf("Enter Numbers: ");
scanf("%s",&B);
fflush(stdin);
printf("Enter Numbers: ");
scanf("%s",&C);
fflush(stdin);
puts(A);
puts(B);
puts(C);
return(0);
}
When the program is running if i input;
1234
56
78
The output for the puts() functions shows
78561234
7856
78
I'm very confused as to why the output shows this as i would have expected the same as what i put in.
If i try and input only single numbers such as ;
1
2
3
I get the expected output.
I'm really sorry if i'm being stupid, i just don' understands whats happening.
Maybe i should get some sleep.