Explain following declaration
int *P(void);
and
int (*p)(char *a);
Answers were Sorted based on User's Feedback
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 |
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 |
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 |
What is the significance of scope resolution operator?
0 Answers Agilent, ZS Associates,
main() { int *ptr=(int*)malloc(sizeof(int)); *ptr=4; printf("%d",(*ptr)+++*ptr++); }
5 Answers Vector, Vector Solutions,
Can two or more operators such as and be combined in a single line of program code?
What will happen when freeing memory twice
What language is c written?
Do you know pointer in c?
How can I do graphics in c?
what will be the output for the following main() { printf("hi" "hello"); }
What should be keep precautions while using the recursion method?
What are keywords c?
write a programme to convert temperature from farenheit to celcius?
How do you print an address?