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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T19:56:01+00:00 2026-05-18T19:56:01+00:00

Hey. I have this in a header file: struct something { int a; int

  • 0

Hey. I have this in a header file:

struct something {
        int a;
        int b;
};
int all[25][9];

This header file is included in all 3 .c files that I have on my project. One of the files (the main file) has the main function and the others have functions that are used in the main file. They also use variables that are declared on this main file, by using extern type variableName. However, while I do declare struct something *stuff; and later malloc it on the main file (and these other files work with this stuff directly), my all 2d array isn’t declared anywhere but the header file. I use this array in one of those extra .c files. Will this all array be declared in each of them? Should I do it this way? It’s imperative that there’s a reference to all in that header file, for my purposes. Should I just declare all as all[][] and then assign a size to it on the .c file, or something like that?

  • 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-18T19:56:01+00:00Added an answer on May 18, 2026 at 7:56 pm

    If you want multiple source files to share a single array called all you should declare

    extern int all[25][9];
    

    in the header and

    int all[25][9];
    

    in one of the c files.

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

Sidebar

Related Questions

Hey. I have this in a header file: struct something { int a; int
Hey all, I'm about to rip my hair out. I have this client that
hey there i have this code that should save a file from sql server
Hey I have this little batch file that is supposed to compare the timestamps
Hey this is the weirdest problem i've ever encoutered, I have 2 projects that's
Hey guys I simply cannot get this to work. I have some content that
Hey everybody, this is what I have going on. I have two text files.
Hey all, this is the code i have to check for a day thats
Hey guys, I have this quick bit of code that I can't figure out
I have a text file that looks similar to; section header 1: some words

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.