retagged by
8,442 views
5 votes
5 votes

Consider the following program

{
    int x=1;
    printf("%d",(*char(char*)&x));
}

Assuming required header files are included and if the machine in which this program is executed is little endian, then the output will be

  1. 0
  2. 99999999
  3. 1
  4. unpredictable
retagged by

2 Answers

Best answer
18 votes
18 votes
main()
{
int x=1;
printf("%d",(*char(char*)&x));
}

Here,we will get a compilation error because 'char' is extra.

If the code is :

main()
{
int x=1;
printf("%d",(*(char*)&x));
}

 

OUTPUT: 1 option(c)

selected by
6 votes
6 votes
Little endian is given, so A
Answer:

Related questions

1 votes
1 votes
2 answers
1
5 votes
5 votes
6 answers
2
Arjun asked Apr 22, 2018
9,801 views
What is the output of tho following program?main(){ int x=2, y=5; if(x<y) return (x=x+y); else printf("z1"); printf("z2"); }$z2$$z1z2$Compilation errorNone of these
5 votes
5 votes
3 answers
3
Arjun asked Apr 22, 2018
5,574 views
Consider the following declaration :structaddr { char city[10]; char street[30]; int pin; }; struct { char name[30]; int gender; struct addr locate; } person, *kd = &pers...