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 |
Write a program that reads a dynamic array of 40 integers and displays only even integers
Which version do you prefer of the following two, 1) printf(“%s”,str); // or the more curt one 2) printf(str);
You are given any character string. Find the number of sets of vowels that come in the order of aeiou in the given string. For eg., let the given string be DIPLOMATIC. The answer returned must be "The number of sets is 2" and "The sets are "IO and AI". Vowels that form a singleton set must be neglected. Try to post the program executable in gcc or g++ or in java.
Write a C program to print look and say sequence? For example if u get the input as 1 then the sequence is 11 21 1211 111221 312211 12112221 .......(it counts the no. of 1s,2s etc which is in successive order) and this sequence is used in run-length encoding.
main() { int i=10; i=!i>14; Printf ("i=%d",i); }
#define DIM( array, type) sizeof(array)/sizeof(type) main() { int arr[10]; printf(“The dimension of the array is %d”, DIM(arr, int)); }
how can i cast a char type array to an int type array
main() { char s[ ]="man"; int i; for(i=0;s[ i ];i++) printf("\n%c%c%c%c",s[ i ],*(s+i),*(i+s),i[s]); }
What is the subtle error in the following code segment? void fun(int n, int arr[]) { int *p=0; int i=0; while(i++<n) p = &arr[i]; *p = 0; }
Write a program to print a square of size 5 by using the character S.
write the function. if all the character in string B appear in string A, return true, otherwise return false.
int i; main(){ int t; for ( t=4;scanf("%d",&i)-t;printf("%d\n",i)) printf("%d--",t--); } // If the inputs are 0,1,2,3 find the o/p