Explain following declaration
int *P(void);
and
int (*p)(char *a);

Answers were Sorted based on User's Feedback



Explain following declaration int *P(void); and int (*p)(char *a); ..

Answer / vijay

int* p(void) means p is a function that takes no argument a
return a pointer to integer.
int (*p)(char*a) means that p is a pointer to function that
take character pointer as argument and return an integer.

Is This Answer Correct ?    56 Yes 4 No

Explain following declaration int *P(void); and int (*p)(char *a); ..

Answer / binod adhikari

int *p(void)
Here p is a pointer function with no arguments. int *p means p is a pointer function which has to return an memory address of integer type to the called function (i.e. where the pointer function p has been called). (void) means function p does not have any argument.

int *p(char *a);
Here p is a pointer function with one pointer arguments of character type. The called function (i.e. where the pointer function p has been called) pass the memory address of the character variable to pointer function p since it has char *a argument. p is a pointer function so, it has to return an memory address of integer type to the called function.

Is This Answer Correct ?    8 Yes 1 No

Explain following declaration int *P(void); and int (*p)(char *a); ..

Answer / tibu

int *p(void) - says this is function with null parameter
and returns a pointer to an integer.

int (*p)(char *a) - says this is function with a pointer to
a char a as parameter and returns a pointer to an integer.

Is This Answer Correct ?    19 Yes 19 No

Post New Answer

More C Interview Questions

Function shall sum members of given one-dimensional array. However, it should sum only members whose number of ones in the binary representation is higher than defined threshold (e.g. if the threshold is 4, number 255 will be counted and 15 will not) - The array length is arbitrary - output the results to the stdout

0 Answers   XYZ,


What was noalias and what ever happened to it?

0 Answers  


what is the mean of c languages.

1 Answers   Polaris,


how to swap two nubers by using a function with pointers?

1 Answers  


main() { int i = 10; printf(" %d %d %d \n", ++i, i++, ++i); }

10 Answers   TCS, Vector,






11. Look at the Code: #include<string.h> void main() { char s1[]="abcd"; char s2[10]; char s3[]="efgh"; int i; clrscr(); i=strcmp(strcat(s3,ctrcpy(s2,s1))strcat(s3,"abcd")); printf("%d",i); } What will be the output? A)No output B) A Non Integer C)0 D) Garbage

7 Answers   Accenture,


What is meant by inheritance?

0 Answers  


WHAT IS LOW LEVEL LANGUAGE?

2 Answers  


Write a program in c to print 1 121 12321 1234321 123454321

11 Answers   ANR, College School Exams Tests, Mu Sigma, Wipro,


How can I avoid the abort, retry, fail messages?

0 Answers  


How do you determine the length of a string value that was stored in a variable?

0 Answers  


write a c program in such a way that if we enter the today date the output should be next day's date.

0 Answers  


Categories