Programming in C - Arays

16. If storage class is missing in the array definition, by default it will be taken to be

  • Option : D
  • Explanation :
    If it is coming within a function, the storage class will be taken to be automatic. otherwise external
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 *


17. Consider the array definition
int num [10] = {3, 3, 3};
Pick the Correct answers

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 *


18. Consider the following type definition.
typedef char x[10];
x myArray[5];
What will sizeof(myArray) be? (Assume one character occupies 1 byte)

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 *


19. While passing an array as an actual argument, the function call must have the array name

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 *


20. The following program
main( )
{
static int a[ ] = { 7, 8, 9 } ;
printf( "%d", 2[ a ] + a[ 2 ] ) ;
}

  • Option : D
  • Explanation :
    a[2] will be converted to *(a + 2).
    *(a + 2) can as well be written as *(2 + a ) .
    *(2 + a ) is nothing but 2 [a] .
    a [2] is essentially same as 2 [a] which is same as * ( 2 + a ).
    So, it prints 9 + 9 = 18. Some of the modem compilers don't accept 2[a].
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 *