CP pointer Q22

0. 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

  • Option : 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.
Cancel reply

Your email address will not be published. Required fields are marked *


Cancel reply

Your email address will not be published. Required fields are marked *