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

what is associativity explain what is the precidence for * and & , * and ++ how the folloing declaration work 1) *&p; 2) *p++;

0 Answers   L&T,


main is a predefined or user define function if user defined why? if predefined whay?

12 Answers   TCS,


How to convert decimal to binary in C using recursion??

4 Answers   HP, IBM,


What is s in c?

0 Answers  


Why we write conio h in c?

0 Answers  


52.write a “Hello World” program in “c” without using a semicolon? 53.Give a method to count the number of ones in a 32 bit number? 54.write a program that print itself even if the source file is deleted? 55.Given an unsigned integer, find if the number is power of 2?

25 Answers   Datamatics, Solartis, TCS, ThinkBox, Trine,


What is meant by type casting?

0 Answers  


What is this pointer in c plus plus?

0 Answers  


can you change name of main()?how?

3 Answers   HCL, Siemens,


what is a stack

6 Answers  


Write a program or provide a pseudo code to flip the 2nd bit of the 32 bit number ! (Phone Screen)

1 Answers   NetApp, PTU, Wipro,


The operation of a stair case switch best explains the a) or operation b) and operation c)exclusive nor operation d)exclusive or operation Which of the following is/are syntactically correct? a) for(); b) for(;); c) for(,); d) for(;;);

1 Answers   HCL, Public Service Commission,


Categories