Asked by Tanushri Sarkar on May 23, 2024

verifed

Verified

____ shows a correct array initialization statement.

A) char codes[4] = {'s', 'a', 'm', 'p', 'l', 'e'};
B) char codes[] = {'s', 'a', 'm', 'p', 'l', 'e'};
C) char codes = {'s', 'a', 'm', 'p', 'l', 'e'};
D) char codes[*] = {'s', 'a', 'm', 'p', 'l', 'e'};

Array Initialization

The process of assigning initial values to the elements of an array at the time of its declaration.

Char Codes

Numeric representations of characters in computing, such as ASCII values.

  • Learn about the role and dynamics of one-dimensional arrays, particularly regarding their setup.
verifed

Verified Answer

SN
Shina NguyenMay 29, 2024
Final Answer :
B
Explanation :
Option B correctly initializes a character array without specifying the size, allowing the compiler to determine the size based on the number of elements in the initializer list.