func(a,b)

int a,b;

{

return( a= (a==b) );

}

main()

{

int process(),func();

printf("The value of process is %d !\n
",process(func,3,6));

}

process(pf,val1,val2)

int (*pf) ();

int val1,val2;

{

return((*pf) (val1,val2));

}



func(a,b) int a,b; { return( a= (a==b) ); } main() ..

Answer / susie

Answer :

The value if process is 0 !

Explanation:

The function 'process' has 3 parameters - 1, a pointer to
another function 2 and 3, integers. When this function is
invoked from main, the following substitutions for formal
parameters take place: func for pf, 3 for val1 and 6 for
val2. This function returns the result of the operation
performed by the function 'func'. The function func has two
integer parameters. The formal parameters are substituted as
3 for a and 6 for b. since 3 is not equal to 6, a==b returns
0. therefore the function returns 0 which in turn is
returned by the function 'process'.

Is This Answer Correct ?    5 Yes 2 No

Post New Answer

More C Code Interview Questions

what will be the position of the file marker? a: fseek(ptr,0,SEEK_SET); b: fseek(ptr,0,SEEK_CUR);

2 Answers  


How to use power function under linux environment.eg : for(i=1;i<=n;i++){ pow(-1,i-1)} since it alerts undefined reference to 'pow'.

2 Answers  


main() { printf("%d", out); } int out=100;

3 Answers  


PROG. TO PRODUCE 1 1 1 1 2 1 1 3 3 1 1 4 6 4 1

1 Answers  


plz send me all data structure related programs

2 Answers  






Is it possible to print a name without using commas, double quotes,semi-colons?

7 Answers  


Write a function to find the depth of a binary tree.

13 Answers   Adobe, Amazon, EFI, Imagination Technologies,


Find the largest number in a binary tree

7 Answers   Infosys,


int DIM(int array[]) { return sizeof(array)/sizeof(int ); } main() { int arr[10]; printf(“The dimension of the array is %d”, DIM(arr)); }

2 Answers   CSC,


main() { int i=10,j=20; j = i, j?(i,j)?i:j:j; printf("%d %d",i,j); }

2 Answers   Adobe, CSC,


To reverse an entire text file into another text file.... get d file names in cmd line

0 Answers   Subex,


#define square(x) x*x main() { int i; i = 64/square(4); printf("%d",i); }

4 Answers   Google, HCL, Quick Heal, WTF,


Categories