Custom Search

Thursday, March 15, 2007

C - Review II 21,22

21. void ( * abc( int, void ( *def) () ) ) ();
Explain the above statement in general english.
Abc is a poniter to a function, such that the function returns void and accepts one integer argument and one pointer to function which returns void.


22. main(){

int i=10,j=20;

j = i-1, j?(i,j)?i:j:j;

printf("%d %d",i,j);

}
Output 10 10

Explanation:

The Ternary operator ( ? : ) is equivalent for if-then-else statement. So the question can be written as:

if(i,j)

{

if(i,j)

j = i;

else

j = j;

}

else

j = j;

No comments: