Which of the following does not represent a valid storage class in C?

2009

Which of the following does not represent a valid storage class in C?

  1. A.

    automatic

  2. B.

    static

  3. C.

    union

  4. D.

    extern

Attempted by 1 students.

Show answer & explanation

Correct answer: C

Concept

A storage-class specifier in C controls two things about an identifier: its storage duration (how long its storage exists) and its linkage (whether the same identifier refers to one shared entity across files). auto, register, static, and extern are the four specifiers conventionally taught together in introductory C (this 2009-era question predates the standard revision that later added a thread-storage specifier) as “the storage classes.” A type specifier — such as int, struct, or union — is a completely different category: it describes only the kind of data an identifier holds, never its duration or linkage.

Application

  1. Check automatic (the keyword auto): every plain local declaration already has this storage class by default, giving it block-scoped, automatic storage duration — one of the four storage classes.

  2. Check static: it gives a variable duration lasting the whole program run and, at file scope, restricts its linkage to that translation unit — also one of the four storage classes.

  3. Check extern: ordinarily it gives a declaration external linkage, letting it refer to a definition that exists elsewhere (unless it redeclares an identifier that already has internal linkage from an earlier declaration in the same file) — also one of the four storage classes.

  4. Check union: it controls neither duration nor linkage — it is a type specifier defining an aggregate type whose members overlap in memory. It is not a storage class at all.

So among the four options, only union fails to name a storage class — it belongs to the type-specifier category instead.

Cross-check

The C89/C99 grammar underlying this exam confirms this independently: the storage-class-specifier production groups auto | register | static | extern | typedef — but typedef only introduces a type alias and creates no storage at all, which is why introductory treatments still count just auto/register/static/extern as “the four storage classes.” union, by contrast, has always sat under the separate type-specifier production (alongside void, char, int, struct-or-union-specifier, enum-specifier, …), never under storage-class-specifier — confirming again that it is the one option that does not represent a valid storage class.

Explore the full course: Nta Ugc Net Paper 2

Loading lesson…