C
Programming and Technical
Programming
Technical
#include
void main()
{
int a;
char *x;
x=(char *)&a;
a=512;
x[0]=1;
x[1]=2;
printf("%dn",a);
getch()
;
Read Solution (Total 7)
-
- the answer will differ on different endian machines like in little-endian where last-byte is stored first answer will be 513 as x[0]=1 and x[1]=2 will result in =>00000010 00000001 hence 513,
whereas in big endian it will be 258=> 00000001 00000010 - 10 years agoHelpfull: Yes(3) No(3)
- would someone explain this?
- 10 years agoHelpfull: Yes(3) No(0)
- integer is 2 byte datatype and x is get address of a and a is 512 and it print a value then answr is 512
- 10 years agoHelpfull: Yes(0) No(0)
- plzzzzz explain clearlyy........................!!!!!!!!!!!!!!!1
ithink error because charecter pointer store charecter adress but not int adress - 10 years agoHelpfull: Yes(0) No(0)
- a is int and here char is poiter means address here type casting is done so store 512
- 10 years agoHelpfull: Yes(0) No(0)
- #include
main()
{
int a=10,b=5;
b=a*b/(a=b);
printf("%d %d
",a,b);
} - 10 years agoHelpfull: Yes(0) No(0)
- It shows error in 5th line.(in TURBO C).
- 9 years agoHelpfull: Yes(0) No(0)
C Other Question