C Language MCQ - English
In C, if you pass an array as an argument to a function, what actually gets pass
Home | Discussion ForumIn C, if you pass an array as an argument to a function, what actually gets passed?
Value of elements in array
First element of the array
Base address of the array
Address of the last element of array
Answer : C
View More Related Question
1) What will be the output of the following code?
void main()
{
int a[10];
printf("%d %d", a[-1], a[12]);
}
2) Array passed as an argument to a function is interpreted as
Address of the array.
Values of the first elements of the array.
Address of the first element of the array.
Number of element of the array.
View Answer
3) What will be the output of the program ?
#include <stdio.h>
int main()
{
int arr[1] = {10};
printf("%d", 0[arr]);
return 0;
}
4) What will happen if in a C program you assign a value to an array element whose subscript exceeds the size of array?
The element will be set to 0.
The compiler would report an error.
The program may crash if some important data gets overwritten.
The array size would appropriately grow.
View Answer
5) Consider the following type definition.
typedef char x[10];
x myArray[5];
What will sizeof(myArray) be ? (Assume one character occupies 1 byte)