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 6197807
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T03:53:15+00:00 2026-05-24T03:53:15+00:00

We say that global variables and static variables are always initialized to 0. Then

  • 0

We say that global variables and static variables are always initialized to 0. Then my question is, why do we have separate sections in a binary for initialized and uninitialized data.

I wrote the following code –

int i;
int j=0;
static int k;
static int l=0;

int main()
{
  static int m=0;
  static int n;
    printf("%d, %d\n",i,j);
    printf("%d, %d\n",k,l);
    printf("%d, %d\n",m,n);
    return 0;
}

And the output was –

0, 0
0, 0
0, 0

I checked output of objdump of bss section and only this section contained the variables. But as per the link –

http://www.cprogramming.com/tutorial/virtual_memory_and_heaps.html

Typically, in each process, the virtual memory available to that
process is called its address space. Each process’s address space is
typically organized in 6 sections that are illustrated in the next
picture: environment section – used to store environment variables and
command line arguments; the stack, used to store memory for function
arguments, return values, and automatic variables; the heap (free
store) used for dynamic allocation, two data sections (for initialized
and uninitialized static and global variables) and a text section
where the actual code is kept.

So, I am just confused. If we have two data sections why is all the data placed in .bss section. And also I wanna understand what does .data contain.

Can someone please help me on this?

  • 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-05-24T03:53:16+00:00Added an answer on May 24, 2026 at 3:53 am

    The .data section is typically reserved for variables with values known at compile time or larger blocks of constant memory such as strings that are known at compile time and static array blocks. Also the .bss section stores unintialized or zero valued variables because storing zero’es in the .data section wouldn’t make much sense.

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

Sidebar

Related Questions

Let us say that I have the classes M, A, B, C. M is
I have created a script that analyzes a set of raw data and converts
This may be a bit of an odd question, and what I have in
I have a program that uses an external API which uses its own state.
Say I have some program-wide information, like the root directory of the program or
In reference to setting global and local variables, I've read about memory leaks and
I was reading some questions regarding the $@ global variable and how it can
I'm new to C++ and while learning i came across a lot of places
DEFINE1 = 1 DEFINE2 = 2 DEFINE3 = 3 ... DEFINE10 = 10 Let's

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.