What will be the output of the following C code (after linking to source file having definition of ary1)?
#include < stdio.h >
int main()
{
extern ary1[];
printf(“%d\n”, ary1[0]);
}
a) Value of ary1[0];
b) Compile time error due to multiple definition
c) Compile time error because size of array is not provided
d) Compile time error because datatype of array is not provided
Answer: d
Related Posts
Which of the following gives the memory address of the first element in array?
Which of the following accesses the seventh element stored in array?
What is the correct definition of an array?
What is the index number of the last element of an array with 9 elements?
Which of the following correctly declares an array?
What will be the output of the following C++ code?
#include <iostream>
using namespace std;
int main()
{
char *ptr;
char Str[] = “abcdefg”;
ptr = Str;
ptr += 5;
cout << ptr;
return 0;
}What will be the output of the following C++ code?
#include <iostream>
using namespace std;
int main()
{
char arr[20];
int i;
for(i = 0; i < 10; i++)
*(arr + i) = 65 + i;
*(arr + i) = ‘\0’;
cout << arr;
return(0);
}
Join The Discussion