9 May 2017

what is the output of these codes?


1)      /*     for this question assume system is little endian   */

#include<stdio.h>
int main()
{
  int a=0x12345678;
char *p=(char*)&a;
p++;
printf("%d\n",*p);

}


2) for this question assume system is big endian

#include<stdio.h>
int main()
{
 int a=0x76543210;
char *p=(char*)&a;
p++;
printf("%d\n",*p);

}


Comment the answers with clear explanation...............................

No comments:

Post a Comment

commnet here