Difference between Array & Structure

  • Follow


hi

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

any reply will be appreciated

rgd
enam
091409
0
Reply gogonchoya (1) 3/30/2010 6:32:38 AM

On 2010-03-30, enam <gogonchoya@gmail.com> 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 / usenet-nospam@seebs.net
http://www.seebs.net/log/ <-- lawsuits, religion, and funny pictures
http://en.wikipedia.org/wiki/Fair_Game_(Scientology) <-- get educated!
0
Reply Seebs 3/30/2010 6:31:20 AM


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

An array is a collection of many (one or more) objects that have the 
same object type. A structure is a collection of many (one or more) 
objects that have arbitrary object type.

-- 
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
"Usenet is a strange place" - dmr 29 July 1999
Sig line vacant - apply within
0
Reply Richard 3/30/2010 6:49:02 AM

Seebs <usenet-nospam@seebs.net> writes:
> On 2010-03-30, enam <gogonchoya@gmail.com> 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) kst-u@mib.org  <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"
0
Reply Keith 3/30/2010 7:26:29 AM

On Mar 29, 11:32=A0pm, enam <gogonch...@gmail.com> 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.



0
Reply Michael 3/30/2010 9:29:38 AM

On 30 Mar, 07:32, enam <gogonch...@gmail.com> 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.
0
Reply Dr 3/30/2010 10:19:13 AM

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. 


0
Reply ng2010 4/3/2010 8:49:05 PM

6 Replies
644 Views

(page loaded in 0.097 seconds)

Similiar Articles:













7/24/2012 2:55:15 AM


Reply: