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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T08:32:09+00:00 2026-05-31T08:32:09+00:00

For our assignment we have to code a program in C, but it says

  • 0

For our assignment we have to code a program in C, but it says not to use external variables in the program. Does this mean variables in other files brought into the main code, or am I unable to use variables in the same file if they’re not in the same function? (ie: could I pass a value into a function as an argument and have it return a value that may have to do with a variable in that function and set the return value equal to something, or is that using external variables?)

I’ve Googled around but it’s not exactly clear, and I want to make sure, as this is rather important.

  • 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-31T08:32:10+00:00Added an answer on May 31, 2026 at 8:32 am

    Just to be sure, I’d make all my variables part of a function, and either pass them as parameters or return them from the functions.

    There are at least two interpretations of external variables.

    First off, we have the extern keyword, which basically symbolizes what you would call a global variable. It’s a variable declared in multiple translation unit, but it only exists in one place in memory. It is initialized in a single file and all subsequent changes affect every scope the variable is used in:

    //globals.cpp
    int x = 1337;
    
    //main.cpp
    extern int x;
    
    int main()
    {
       //x is 1337 here
       return 0;
    }
    

    The second meaning could be a variable that is declared and defined in class scope, but not used as extern. However, you could consider it external to the methods.

    //main.cpp
    int x = 1337; //is this external?
                  //could be, remove it just to be safe
    
    int main()
    {
       return 0;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have to use SQLPLUS for my database class, and our first assignment is
Ok so for an assignment we have to make our first program. Mine is
As an assignment in operating systems we have to write our own code for
In my assembly language class, our first assignment was to write a program to
I have been given an assignment to drop one of our product's dll and
We were given an assignment in our C programming class to modify a program
I have this bit of code: ... ComplexNumber C1; ComplexNumber C2; cout << Enter
This is not really a technical programming question, but has more to do with
i have read the code of ping. and i'm confused this code *(u_char *)(&u)
For our assignment we need to write code for a neural network. The way

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.