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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T22:17:07+00:00 2026-06-07T22:17:07+00:00

Assume that I have which contains three source files ( .c ), and three

  • 0

Assume that I have which contains three source files (.c), and three of them included “file.h”, i.e at the beginning of each one of them I wrote #include "file.h"
.

In the file.h itself I wrote int num=4.

I have a general launching problem. when I wrote int num, It compiled.

What is the problem? and why does the non-initializing case work?

(I’m using Eclispe)

  • 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-07T22:17:09+00:00Added an answer on June 7, 2026 at 10:17 pm

    In C header files don’t have any special semantics for the compiler, they are just text that gets expanded inline by the pre-processor. It means that your variable definition will be seen three times by the linker. To avoid confusion, the linker doesn’t know which one of the three values are correct. Even though they happen to have the same value this time, the linker is dumb and doesn’t know that.

    If you just have “int num;”, it’s a special case where the variable gets allocated as a common instead of data and the linker knows to unify commons in the final linking stage. Generally, I’d say it’s bad form to use commons and header files should only have “extern int foo;” while the variable itself is defined in only one linking unit.

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

Sidebar

Related Questions

Let's assume that we have a data frame x which contains the columns job
Assume that we have a large file which can be read in chunks of
Assume, for whatever reason, that we have three inline scripts on a page. Each
Assume that I have one big table with three columns: user_name, user_property, value_of_property. Lat's
Assume that I have 2 .php files : index.php and ajax.php This is index.php:
I have a question about generic list. Assume that I have a database which
Assume I have some program that pulls airline data. Each airline data uses a
Assume that we have two sets: A=(a_1,a_2,...,a_m) and B=(b_1,b_2,...,a_n) (Not necessarily of same size).
Assume that i have created a client TCP Socket in Activity A. I want
Assume that I have a backbone model that has a bunch of boolean attributes:

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.