ExamVeda
Login
Home
This question belongs to C Program Arrays And Strings
Arrays and Strings
?

Size of the array need not be specified, when

Answer & Solution
Correct Answer: Option A
In C programming, the size of the array does not need to be specified when initialization is a part of definition.

Initialization during Definition:
When an array is defined and initialized at the same time, the size of the array can be omitted. The size is automatically determined by the number of elements provided in the initialization. For example:
int arr[] = {1, 2, 3, 4, 5}; // Size is determined by the number of elements

Declaration:
When declaring an array without initializing it, the size must be specified if the array is not initialized. For example:
int arr[5]; // Size must be specified

Formal Parameter:
In function prototypes or definitions where an array is used as a formal parameter, the size does not need to be specified. For example:
void function(int arr[]); // Size not required

All of These:
This option is incorrect because the size must be specified in cases other than initialization during definition.

Therefore, the correct answer is Option A: Initialization is a part of definition.
Examveda
Question posted by Examveda
Community

Join the Discussion

4 Comments
GURSIDAK SINGH
GURSIDAK SINGH 5 years ago
it is not allowed to declare array without size i checked it also, then its all of the above is correct
Lakshmi Bai
Lakshmi Bai 6 years ago
What is size of () in C?*
Sangamesh Kurtakoti
Sangamesh Kurtakoti 6 years ago
What is the value of x in this C code? *
Aanchal Gupta
Aanchal Gupta 7 years ago
I guess the the answer is a