Difference between Array & Structure

Discussion in 'C Programming' started by Seebs, Mar 30, 2010.

  1. Seebs

    Seebs Guest

    On 2010-03-30, enam <> wrote:
    > my name is enam. i hv a qs:
    > Difference between Array & Structure


    One alphebetizes under A, the other under S.

    Seriously, this question is too broad to have any meaning. How about you
    start by reading about them in your textbook, and ask specific questions
    if there's something you don't understand?

    -s
    --
    Copyright 2010, all wrongs reversed. Peter Seebach /
    http://www.seebs.net/log/ <-- lawsuits, religion, and funny pictures
    http://en.wikipedia.org/wiki/Fair_Game_(Scientology) <-- get educated!
     
    Seebs, Mar 30, 2010
    #1
    1. Advertising

  2. Seebs

    enam Guest

    hi

    my name is enam. i hv a qs:
    Difference between Array & Structure

    any reply will be appreciated

    rgd
    enam
    091409
     
    enam, Mar 30, 2010
    #2
    1. Advertising

  3. Seebs <> writes:
    > On 2010-03-30, enam <> wrote:
    >> my name is enam. i hv a qs:
    >> Difference between Array & Structure

    >
    > One alphebetizes under A, the other under S.
    >
    > Seriously, this question is too broad to have any meaning. How about you
    > start by reading about them in your textbook, and ask specific questions
    > if there's something you don't understand?


    And please, spell out your words. "I have a question" is much easier
    to read than "i hv a qs".

    --
    Keith Thompson (The_Other_Keith) <http://www.ghoti.net/~kst>
    Nokia
    "We must do something. This is something. Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"
     
    Keith Thompson, Mar 30, 2010
    #3
  4. On Mar 29, 11:32 pm, enam <> wrote:
    > hi
    >
    > my name is enam. i hv a qs:
    > Difference between Array & Structure
    >
    > any reply will be appreciated
    >


    C's concept of a "struct"ure is, what in Computing Science parlance is
    referred to as an "ordered, heterogenous array". C's concept of an
    array is what is what in Computing Science palance is referred to as a
    "homogeneous array".

    Yes, you could support unordered heterogenous arrays in C by casting
    pointers in an array, etc.

    The main advantage of a C struct is that you can define the pieces to
    whatever level of detail you happen to care to (subject to some
    usually reasonable limitations). The main disadvantage is that you
    MUST do so.

    C arrays also permit nesting, but you are stuck with the limitation
    that all of the elements will be of the same time. You can, however,
    have arrays of structs of arrays of structs also.
     
    Michael Angelo Ravera, Mar 30, 2010
    #4
  5. On 30 Mar, 07:32, enam <> wrote:
    >
    > my name is enam. i hv a qs:
    > Difference between Array & Structure
    >

    /* arrays */
    int x[20];
    double x[20];
    double x[20][20];

    /* structures */
    struct point
    {
    double x;
    double y;
    double z;
    };

    struct employee
    {
    char firstnames[32];
    char surname[32];
    int payrollno;
    double salary;
    };

    /* array of structures */

    struct point triangle[3];


    That's basically what you need to know.
     
    Dr Malcolm McLean, Mar 30, 2010
    #5
  6. Seebs

    ng2010 Guest

    enam wrote:
    > hi
    >
    > my name is enam. i hv a qs:
    > Difference between Array & Structure
    >
    > any reply will be appreciated
    >


    Arrays are homogeneous and structs are heterogeneous.
     
    ng2010, Apr 3, 2010
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. jakk
    Replies:
    4
    Views:
    12,380
  2. Replies:
    9
    Views:
    25,400
    Lal Bahadur Singh
    Nov 11, 2011
  3. Ahmad Humayun
    Replies:
    10
    Views:
    560
    Keith Thompson
    May 28, 2008
  4. darren_uk
    Replies:
    4
    Views:
    132
    Tad McClellan
    Nov 1, 2003
  5. PerlFAQ Server
    Replies:
    0
    Views:
    146
    PerlFAQ Server
    Apr 16, 2011
Loading...

Share This Page