6,994 views
0 0 votes
Under which of the following conditions, the size of an one-dimensional array need to be specified ?

a) when initialization is a part of definition

b) when it is a declaration

c) when it is a formal parameter or actual parameter

d) none of the above

2 Answers

Best answer
2 2 votes

Option (d) None of the above is correct.

Because,

When Initialization is a part of declaration then we do not need the size.

In the declaration also we do not need to give the size of array. eg. extern int abc[]; is saying that refer to an global array abc defined in some file. 

Similarly when we use that as formal and actual parameter, we do not have to give the size. It will passed as a separate variable. 

selected by
1 1 vote

b) when it is a declaration

reshown by
Position:
Show:

Related questions

7 7 votes
3 3 answers
350
350 views
GO Classes asked Jun 30
350 views
What is the output of the following code?#include <stdio.h struct Student { int roll; int marks; }; int main() { struct Student s[3] = { {1, 50}, {2, 60}, {3, 70} }; stru...
5 5 votes
2 2 answers
298
298 views
GO Classes asked Jun 29
298 views
What is the output of the following code?#include <stdio.h struct Student { int roll; int marks; }; int main() { struct Student s[3] = { {1, 70}, {2, 80}, {3, 90} }; s .m...
8 8 votes
3 3 answers
388
388 views
GO Classes asked Jun 25
388 views
What is the output of the following code?#include <stdio.h int main() { int a [3] = { {2, 4, 6}, {8, 10, 12} }; printf("%d %d %d", a , *(*(a + 1) + 1), *(*a + 2)); retur...
9 9 votes
2 2 answers
250
250 views
GO Classes asked Jun 24
250 views
What is the output of the following code?#include <stdio.h void update(int a[]) { a[0] = a[0] + a ; *(a + 1) = *(a + 1) + 5; } int main() { int arr[] = {2, 4, 6}; update(...