Which option shows the correct form of an array declarator in C?

2026

Which option shows the correct form of an array declarator in C?

Answer: A. int arr[]ConceptIn C, an array declarator is formed by attaching square brackets to a declarator identifier. The brackets may contain an array bound; in contexts…

  1. A.

    int arr[]

  2. B.

    array int arr

  3. C.

    int arr{}

  4. D.

    int arr

Attempted by 126 students.

Show answer & explanation

Correct answer: A

Concept

In C, an array declarator is formed by attaching square brackets to a declarator identifier. The brackets may contain an array bound; in contexts permitted by the language, the bound can be omitted.

An omitted bound produces an incomplete array type. Some declaration contexts permit that form, such as an extern declaration, while an object definition that needs a complete type must obtain its size from a bound or initializer.

Application

  1. Read int as the element-type specifier.

  2. Read arr as the declarator identifier.

  3. Read [] as the array-declarator suffix attached to arr; therefore int arr[] is the offered form that uses C array-declarator grammar.

Contrast

  • array int arr uses array as a prefix keyword, but C has no such declaration keyword.

  • int arr{} uses braces, which are associated with initializer syntax rather than the array-declarator suffix.

  • int arr declares arr with scalar type int because no array suffix is present.

Cross-check

A concrete complete example is int arr[5];: the type is int, the identifier is arr, and the postfix brackets make it an array declarator. Removing only the bound leaves the same declarator form, int arr[], though whether that incomplete form is allowed depends on context.

Result

Among the offered forms, int arr[] has the C array-declarator structure.

Explore the full course: Tpsc Assistant Technical Officer

Loading lesson…