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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T20:56:59+00:00 2026-05-13T20:56:59+00:00

AFAIK, extern keyword should be used for declaration and no value can be associated

  • 0

AFAIK, extern keyword should be used for declaration and no value can be associated with the variable being declared with extern keyword. But supposing I write a statement like

extern int i = 10;

Should the compiler flag an error for the same? I have seen some compilers being tolerant and ignoring this? Why is this so? What does the ‘C’ standard says about this?

EDIT: @All, Thanks for the answers. I have a doubt still though. Suppose I have the definition for this variable without the extern linkage in another file say a.c and I add this statement in b.c. Still is it Ok for the compiler not to flag an error? Does it come under redefintion?

  • 1 1 Answer
  • 2 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-13T20:57:00+00:00Added an answer on May 13, 2026 at 8:57 pm

    That’s valid syntax, there is even an essentially identical example in the C99 standard. (See §6.9.2-4.)

    It’s true that the examples are not normative but I believe it was intended to be legal syntax. The compiler will often output a warning, because it doesn’t really accomplish anything.

    4 EXAMPLE 1

    int i1 = 1;             // definition, external linkage
    static int i2 = 2;      // definition, internal linkage
    extern int i3 = 3;      // definition, external linkage
    int i4;                 // tentative definition, external linkage
    static int i5;          // tentative definition, internal linkage
    int i1;                 // valid tentative definition, refers to previous
    int i2;                 // 6.2.2 renders undefined, linkage disagreement
    int i3;                 // valid tentative definition, refers to previous
    int i4;                 // valid tentative definition, refers to previous
    int i5;                 // 6.2.2 renders undefined, linkage disagreement
    extern int i1;          // refers to previous, whose linkage is external
    extern int i2;          // refers to previous, whose linkage is internal
    extern int i3;          // refers to previous, whose linkage is external
    extern int i4;          // refers to previous, whose linkage is external
    extern int i5;          // refers to previous, whose linkage is internal
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

AFAIK when reducing an array we can only output once variable at the end
AFAIK, a thread can not access UI components. But I want to preload images
AFAIK profilers can only tell how much time is spent in each function. But
AFAIK view controller classes should be used for managing their views, IBActions, IBOutlets and
AFAIK the IsCellularDataRoamingEnabled property indficates if the connection supports roaming as such. But can
I'm a little confused about the naming conventions used here... but AFAIK it is
Afaik, you can change/manipulate browser settings in Mozilla/Netscape browsers. For Instance netscape.security.PrivilegeManager.enablePrivilege('someprivilege'); Of course
AFAIK, Python evaluates the defaults of a function only once, at declaration time. So
AFAIK, we can have two static variables with the same name in different functions?
AFAIK, It's agreed that accessing virtual members from constructor is a dangerous practice. Can

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.