Explain following declaration
int *P(void);
and
int (*p)(char *a);
Answer Posted / 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 |
Post New Answer View All Answers
Why cant I open a file by its explicit path?
Is javascript based on c?
What is size of union in c?
What is bss in c?
What is 2 d array in c?
How can you allocate arrays or structures bigger than 64K?
main(){char *str;scanf("%s",str);printf("%s",str); }The error in the above program is: a) Variable 'str' is not initialised b) Format control for a string is not %s c) Parameter to scanf is passed by value. It should be an address d) none
What is the use of getchar functions?
In C language what is a 'dangling pointer'?
Explain how do you convert strings to numbers in c?
What is volatile, register definition in C
What is data types?
Difference between constant pointer and pointer to a constant.
What are c preprocessors?
Which is the best website to learn c programming?