Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8877747
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T19:32:30+00:00 2026-06-14T19:32:30+00:00

Both Static and Global variables in C are stored in Data segment ( Uninitialized

  • 0

Both Static and Global variables in C are stored in Data segment ( Uninitialized or Initialized ) but Static variable scope is only that file or that function and global variable scope is whole program and both variables life is whole program how it is implemented. They are stored in same segment even though how they different in behavior.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T19:32:31+00:00Added an answer on June 14, 2026 at 7:32 pm

    Even both are in the data segement there is a difference ,static variables has internal linkage and global has external linkage (by default) that’s why static is visible in the current translation unit but globals are visible in others.

    By declaring variables static (which are in global scope), It means you are restricting the variable to the current file only.

    Also initialzed and uninitialized variables are stroed in two different segement

    here is the actual segmentation for every variables and code for a program.

    C99 Standard : 6.2.2 Linkages of identifiers
    

    2

    In the set of translation units and libraries that constitutes an entire program, each
    declaration of a particular identifier with external linkage denotes the same object or
    function. Within one translation unit, each declaration of an identifier with internal
    linkage
    denotes the same object or function. Each declaration of an identifier with no
    linkage
    denotes a unique entity.

    3

    If the declaration of a file scope identifier for an object or a function contains the storageclass
    specifier static, the identifier has internal linkage.22)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Usually, the static and global variables are both stored in the .data or .bss
Suppose I have two classes that both contain a static variable, XmlTag. The second
I have used a static global variable and a static volatile variable in file
Apart from global and static data what else are allocated on Data segment ?
I'm working with Progress 10.1c I have a class that contains both static and
Both of these frameworks are great, but I've noticed that Knockout likes to point
I wonder about the use of the static keyword as scope limiting for variables
I can't find a good explanation about global non static variables in unnamed namespace.
Given following definition of global (or static local) variable: static const <type>* const ptr
Which C++ cross-platform GUI toolkit gives smallest footprint with both static and dynamic builds?

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.