hamburger menu
All Coursesall course arrow
adda247
reward-icon
adda247
    arrow
    arrow
    arrow
    Which of the following storage classes in C ensures that the variable is stored in memory only once and has internal linkage?
    Question



    Which of the following storage classes in C ensures that the variable is stored in memory only once and has internal linkage?

    A.

    auto

    B.

    register

    C.

    static

    D.

    extern

    E.

    typedef

    Correct option is C

    In C, the static storage class ensures that the variable is stored in memory only once and retains its value across multiple function calls. Static variables have internal linkage by default, meaning they are accessible only within the file in which they are declared.
    Important Key Points:
    1. Static variables are initialized only once and maintain their value between function calls.
    2. Internal linkage ensures that the variable is restricted to the file it is declared in, preventing access from other files.
    3. Example of a static variable:

    Knowledge Booster:
    · auto: Default storage class for local variables. It has automatic duration and block scope, but no internal linkage.
    · register: Suggests that the variable be stored in a CPU register for faster access. It has no linkage and is local to the block.
    · extern: Used to declare global variables accessible across multiple files. It provides external linkage.
    · typedef: Not a storage class but a keyword used to create type aliases, e.g., typedef unsigned int uint;.

    test-prime-package

    Access ‘SEBI Grade-A Assistant Manager’ Mock Tests with

    • 60000+ Mocks and Previous Year Papers
    • Unlimited Re-Attempts
    • Personalised Report Card
    • 500% Refund on Final Selection
    • Largest Community
    students-icon
    177k+ students have already unlocked exclusive benefits with Test Prime!

    Free Tests

    Free
    Must Attempt

    IBPS Clerk Prelims Mock 01

    languageIcon English
    • pdpQsnIcon100 Questions
    • pdpsheetsIcon100 Marks
    • timerIcon60 Mins
    languageIcon English
    Free
    Must Attempt

    IBPS Clerk Prelims Mock 02

    languageIcon English
    • pdpQsnIcon100 Questions
    • pdpsheetsIcon100 Marks
    • timerIcon60 Mins
    languageIcon English
    Free
    Must Attempt

    grammar

    languageIcon English
    • pdpQsnIcon10 Questions
    • pdpsheetsIcon10 Marks
    • timerIcon7 Mins
    languageIcon English