Declaring A Global Structure?

This is a discussion on Declaring A Global Structure? within the C Programming forums, part of the General Programming Boards category; say for instance i would like to declare a global structure of data type int char float how do i ...

  1. #1
    Registered User
    Join Date
    Mar 2008
    Posts
    5

    Declaring A Global Structure?

    say for instance i would like to declare a global structure of data type int char float how do i do that? could u demonstrate using variables and defining the structure for me plz

  2. #2
    CSharpener vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,484
    Quote Originally Posted by runnings View Post
    say for instance i would like to declare a global structure of data type int char float how do i do that? could u demonstrate using variables and defining the structure for me plz
    You do not know how to declare var of type struct or you do not know how to declare global var?
    Which is it?

    And my advice - do not use global vars...
    The first 90% of a project takes 90% of the time,
    the last 10% takes the other 90% of the time.

  3. #3
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,612
    A struct is a blueprint. A blueprint can be used wherever you have access to that blueprint.
    So create the blueprint in a header, then include that header wherever you need to use the blueprint.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. basic question about global variables
    By radeberger in forum C++ Programming
    Replies: 0
    Last Post: 04-06-2009, 12:54 AM
  2. Global Structure question.
    By tdep in forum C Programming
    Replies: 6
    Last Post: 07-04-2007, 05:59 PM
  3. passing structure arrays to functions?
    By bem82 in forum C Programming
    Replies: 3
    Last Post: 10-30-2006, 05:17 AM
  4. structure ...solution plz????
    By hegdeshashi in forum C Programming
    Replies: 4
    Last Post: 07-24-2006, 09:57 AM
  5. Binary Search Trees Part III
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 10-02-2004, 03:00 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21