C Programming MCQ

1:

 A function q that accepts a pointer to a character as argument and returns a pointer to an array of integer can be declared as

A.

int (*q (char*) )[ ] 

B.

Int *q(char *)[ ] 

C.

int (*q) (char *)[ ] 

D.

none of the above

 

Answer : A

Explanation :

Function Input : 'Pointer to a character'.

For example : Pointer to a character will be represented as "char * Y" which will signify (Y is a pointer to character)

Similarly in this case, a general argument notation would be "char *"

Function Output : 'Pointer to an array of integers'.

For example : Pointer to an array of integers will be represented as "int(*Z)[10]" which will signify (Z is a pointer to an array of integers)

Similarly in this case, a general argument notation would be "int(*)[]"

Function Name : 'q'.

Now, in this case when we combine the input, output and function name, the function representation will becomes 

int (*q (char*) )[ ]

This will hence signify that the function takes an input as pointer to a character and returns pointer to an integer array.

deepa said: (8:39pm on Monday 2nd September 2013)
i think answer is b can u explain me how...

Write your comments here:


Report Error
 

Option: A

Explanation : Explanation will come here. Explanation will come here. Explanation will come here. Explanation will come here. Explanation will come here.