retagged by
750 views
2 votes
2 votes

#include<stdio.h>
#define create_node struct node {char x, y;};
#define call_main int main() {
#define create_pointer struct node *p=&obj;
#define create_object(a,b) struct node obj={b+a,a};
#define print_value printf("%c", *((char*)p+1));
#define end_program return 0;}
//new statements to be added below this line... (comment line)

This program is left incomplete. The correct sequence of statements that much to be added after the comment line to make the program complete and yield an output 'z' (ignoring quotes)
1.
create_node
create_object('z','y');
call_main
create_pointer
print_value
end_program


2.
create_node
call_main
create_object('z','y');
create_pointer
print_value
end_program


3.
create_node
call_main
create_pointer
create_object(122,'y');
print_value
end_program


4.
call_main
create_node
create_object(122,'y');
create_pointer
print_value
end_program

 

  1. Only $1$ and $2$ are correct
  2. Only $2$ and $3$ are correct
  3. $1$, $2$ and $4$ are correct
  4. Only $3$ is correct
retagged by

Please log in or register to answer this question.

Answer:

Related questions

4 votes
4 votes
1 answer
1
Ruturaj Mohanty asked Dec 27, 2018
1,711 views
Consider the following C language code:#include<stdio.h int main() { int x=64; int i=0; while (i++<3) x=(((x<<2)+(x>>1))>>1); printf("%d", x); return 0; }What is the outp...
4 votes
4 votes
2 answers
2
6 votes
6 votes
2 answers
3
Arjun asked Oct 18, 2016
630 views
What is the output of this program?#include <stdio.h int main() { char *ptr; char string[] = "Hello 2017"; ptr = string; ptr += 4; printf("%s",++ptr); }Hello 2017ello 201...