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 ?    9 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

Develop a flow chart and write a c program to find the roots of a quadratic equation ax2+bx+c=0 using switch and break statement.

1 Answers   TCS,


Write a program to print distinct words in an input along with their count in input in decreasing order of their count

0 Answers  


Is a house a mass structure?

0 Answers  


Why do we need functions in c?

0 Answers  


define function

4 Answers   Assurgent, Sonata,






Is c# a good language?

0 Answers  


Write a program to add a given duration with time(24hrs format)

1 Answers   Protech,


Given an array of characters, how would you reverse it? How would you reverse it without using indexing in the array?

1 Answers   Microsoft,


What are the header files used in c language?

0 Answers  


How would you sort a linked list?

1 Answers  


#include <stdio.h> void main() { int i=-1,j=1,k,l; k=!i&&j; l=!i||j; printf ("%d%d",k,l) ; }

3 Answers   SRG,


Why shouldn’t I start variable names with underscores?

0 Answers  


Categories