User Profile
Collapse
-
Yes!It's the same here.I mean the value is random when out short range.Whether s or y is stored in heap,it works.They may be constant in memory so there is a unexpected interference?... -
Thank you!
So this is an undefined,r?
I tried to store y in heap,it works as I expected.Looks like it's about stack.Leave a comment:
-
A question About the difference of %hd and %d in scanf() in C
the output is gonna be"0,short(s) ".Code:int y; short s; scanf("%d %d", &y, &s); printf("%d,%d\n", y, s);
Obviously the printf() doesn't care %hd or %d,but why y presents "0" instead of s in the case of s received the wrong type and s presents rightly
No activity results to display
Show More
Leave a comment: