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));
}
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 |
Give a one-line C expression to test whether a number is a power of 2.
main() { char *p = “ayqm”; char c; c = ++*p++; printf(“%c”,c); }
main() { int (*functable[2])(char *format, ...) ={printf, scanf}; int i = 100; (*functable[0])("%d", i); (*functable[1])("%d", i); (*functable[1])("%d", i); (*functable[0])("%d", &i); } a. 100, Runtime error. b. 100, Random number, Random number, Random number. c. Compile error d. 100, Random number
write a c-program to display the time using FOR loop
pls anyone can help me to write a code to print the values in words for any value.Example:1034 to print as "one thousand and thirty four only"
plz send me all data structure related programs
struct Foo { char *pName; char *pAddress; }; main() { struct Foo *obj = malloc(sizeof(struct Foo)); clrscr(); obj->pName = malloc(100); obj->pAddress = malloc(100); strcpy(obj->pName,"Your Name"); strcpy(obj->pAddress, "Your Address"); free(obj); printf("%s", obj->pName); printf("%s", obj->pAddress); } a. Your Name, Your Address b. Your Address, Your Address c. Your Name Your Name d. None of the above
Write a program to receive an integer and find its octal equivalent?
write a c program to print magic square of order n when n>3 and n is odd?
main() { extern i; printf("%d\n",i); { int i=20; printf("%d\n",i); } }
what is the output of following program ? void main() { int i=5; printf("%d %d %d %d %d ",i++,i--,++i,--i,i); }
What is the output of the program given below main() { signed char i=0; for(;i>=0;i++) ; printf("%d\n",i); }