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

  • Home
  • SEARCH
  • 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 8652591
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T14:20:34+00:00 2026-06-12T14:20:34+00:00

I understand the terms declaration and definition as below. Declaration: This is just a

  • 0

I understand the terms declaration and definition as below.

Declaration: This is just a heads up to the compiler that a variable of specified “name” and “type” exists in the code. So that it can be defined/assigned at later point of time

Definition: This is the process where an instance of the type is created by allocating a suitable space of memory.

int var; //Declaration and Definition-Agreed!!!
extern int var; //Declaration only ?
static int var; //Declaration only ?

My mind refuses to agree the second and third ones as declaration only statements. Because in many references I see, “extern and static variables are automatically initialized to zero upon memory allocation”. And as you see in following code.

#include <stdio.h>
int main()
{
   static int i;
   printf("%d\n",i);
   return 0;
}

The output is 0. So Here it looks like the static int i; is declaration,definition and auto initialization statement. So please add your justification for 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-06-12T14:20:36+00:00Added an answer on June 12, 2026 at 2:20 pm

    Objects with static storage duration are initialized by zero in C.

    static int a; // initialized by zero
    int b;        // file-scope, static storage duration, initialized by zero
    
    int main(void)
    {
         int c;        // automatic storage duration, indeterminate value
         static int d; // initialized by zero
    }
    

    a, c and d are declarations and definitions of objects.

    b is a declaration and a definition because there is no other file-scope occurrence of b until the end of the translation unit. Before the end of the translation unit, the declaration is a tentative definition.

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

Sidebar

Related Questions

I understand this is an easy question but for some reason this just isn't
I believe I understand this in terms of hardware, where multiple individuals 'share' the
I understand that this response clearly states that this is not possible without a
I need to understand what is happening in terms of memory in this situation.
I've tried to put this in generic terms to make it easier to understand.
Is there any substantial difference between those two terms?. I understand that JDK stands
I understand that IronPython is an implementation of Python on the .NET platform just
I understand the from the terms that RCR would rotate the bit from the
I was trying to understand the terms Synchronous and Asynchronous communication but i am
I am trying to understand static analysis of Java bytecode/source-code. These terms frequently come

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.