Examveda

Size of the array need not be specified, when

A. Initialization is a part of definition

B. It is a declaratrion

C. It is a formal parameter

D. All of these

Answer: Option A

Solution (By Examveda Team)

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.

This Question Belongs to C Program >> Arrays And Strings

Join The Discussion

Comments (4)

  1. GURSIDAK SINGH
    GURSIDAK SINGH:
    4 years ago

    it is not allowed to declare array without size i checked it also, then its all of the above is correct

  2. Lakshmi Bai
    Lakshmi Bai:
    6 years ago

    What is size of () in C?*

  3. Sangamesh Kurtakoti
    Sangamesh Kurtakoti:
    6 years ago

    What is the value of x in this C code? *

  4. Aanchal Gupta
    Aanchal Gupta:
    6 years ago

    I guess the the answer is a

Related Questions on Arrays and Strings