M
muralipmanohar
Hello all ,
I need a help on this code
kindly help me out
for the below code I worked on the Turboc
the result I was expecting was different from what has been printed I
have indicated the line with " /*this one*/" line no 10
I did expected some junk for the first %ld and 6553 for the second %d
,but it printed in different way I am also pasting the result printed ,
it is below the code .
I am totally confused because I got one answer that was it depends on
compiler but I am not satisfied .can any body kind hearted people help
me with proper explanation
thanks and regards
/*code */
1 int main(void)
2 {
3 unsigned int un = 3000000000; /* system with 32-bit int */
4 short end = 200; /* and 16-bit short */
5 unsigned int big = 6553;
6 long long verybig = 12345678908642;
7 clrscr();
8 printf("un = %u and not %d\n", un, un);
9 printf("end = %hd and %d\n", end, end);
10 printf("big = %ld and not %d\n", big,big); /*this one */
11 printf("verybig= %lld and not %ld\n", verybig, verybig);
12 getch();
13 return 0;
14 }
the Output is below
un = 24064 and not 24064
end = 200 and 200
big = 429463961 and not 996 /* <-why it is 996 whynot 6553*/
verybig= 1942899938 and not 1942899938
I need a help on this code
kindly help me out
for the below code I worked on the Turboc
the result I was expecting was different from what has been printed I
have indicated the line with " /*this one*/" line no 10
I did expected some junk for the first %ld and 6553 for the second %d
,but it printed in different way I am also pasting the result printed ,
it is below the code .
I am totally confused because I got one answer that was it depends on
compiler but I am not satisfied .can any body kind hearted people help
me with proper explanation
thanks and regards
/*code */
1 int main(void)
2 {
3 unsigned int un = 3000000000; /* system with 32-bit int */
4 short end = 200; /* and 16-bit short */
5 unsigned int big = 6553;
6 long long verybig = 12345678908642;
7 clrscr();
8 printf("un = %u and not %d\n", un, un);
9 printf("end = %hd and %d\n", end, end);
10 printf("big = %ld and not %d\n", big,big); /*this one */
11 printf("verybig= %lld and not %ld\n", verybig, verybig);
12 getch();
13 return 0;
14 }
the Output is below
un = 24064 and not 24064
end = 200 and 200
big = 429463961 and not 996 /* <-why it is 996 whynot 6553*/
verybig= 1942899938 and not 1942899938