[comp.lang.c] Structures and arrays

jfjr@mitre-bedford.arpa (Freedman) (01/20/88)

	id AA19202; Fri, 15 Jan 88 12:15:46 EST
Date: Fri, 15 Jan 88 12:15:46 EST
From: jfjr (Freedman)



Suppose I have the following

typedef struct /* I despise structure tags */
  { 
    /* some irrelevant field declarations */
   char string[80];
   int  vector [4];
  } structure_type;


structure_type first_structure,second_structure;

/* The various fields of first_structure get filled */
/* and  somewhere in the code I do this             */

second_structure = first_structure; /* ANSI standard allows this */

Now, tell me about the string and vector fields of second structure.
Since they are arrays then the fields are actually pointers. The
question is: are the string and vector fields of "second_structure"
pointing ad the same addresses as the corresponding fields of
first structure or are they pointing to different areas of
memory into which the contents of the arrays pointed to
in first_structure have been copied(whew - what I meant not
what I said)??


Jerry Freedman, Jr      "Thank you, folks,
jfjr@mitre-bedford.arpa   for those kind applause"
(617)271-4563