int aaa() {printf(“Hi”);}
int bbb(){printf(“hello”);}
iny ccc(){printf(“bye”);}
main()
{
int ( * ptr[3]) ();
ptr[0] = aaa;
ptr[1] = bbb;
ptr[2] =ccc;
ptr[2]();
}
Answer / susie
Answer :
bye
Explanation:
int (* ptr[3])() says that ptr is an array of pointers to
functions that takes no arguments and returns the type int.
By the assignment ptr[0] = aaa; it means that the first
function pointer in the array is initialized with the
address of the function aaa. Similarly, the other two array
elements also get initialized with the addresses of the
functions bbb and ccc. Since ptr[2] contains the address of
the function ccc, the call to the function ptr[2]() is same
as calling ccc(). So it results in printing "bye".
| Is This Answer Correct ? | 3 Yes | 0 No |
void main() { int i=5; printf("%d",i++ + ++i); }
#include<stdio.h> main() { struct xx { int x; struct yy { char s; struct xx *p; }; struct yy *q; }; }
int a=1; printf("%d %d %d",a++,a++,a); need o/p in 'c' and what explanation too
WAP to display 1,2,3,4,5........N
String reverse with time complexity of n/2 with out using temporary variable.
main() { char name[10],s[12]; scanf(" \"%[^\"]\"",s); } How scanf will execute?
main() { int i=5; printf(“%d”,i=++i ==6); }
main() { int i; clrscr(); printf("%d", &i)+1; scanf("%d", i)-1; } a. Runtime error. b. Runtime error. Access violation. c. Compile error. Illegal syntax d. None of the above
main() { int c = 5; printf("%d", main||c); } a. 1 b. 5 c. 0 d. none of the above
void main() { static int i=5; if(--i){ main(); printf("%d ",i); } }
Find your day from your DOB?
15 Answers Accenture, Microsoft,
Give a oneline C expression to test whether a number is a power of 2?
25 Answers EA Electronic Arts, Google, Motorola,