how to copy a structure of record to another structure with type,size in the menber of structure... 
Author Message
 how to copy a structure of record to another structure with type,size in the menber of structure...

how to copy a sturcture to another structure. for example:

struct{                        struct{
 char a[5];                       char a[5];
 char b[11];      =>          char b[11];
 int c;                               int c;

Quote:
}data;                        }temp;

thanks.


Sat, 06 Nov 2004 18:44:56 GMT  
 how to copy a structure of record to another structure with type,size in the menber of structure...


Quote:

> how to copy a sturcture to another structure. for example:

> struct{                        struct{
>  char a[5];                       char a[5];
>  char b[11];      =>          char b[11];
>  int c;                               int c;
> }data;                        }temp;

They're different types; copying them is probably a Bad Idea. If you
want to copy them, why not make them the same type:

    /* declare the structure type */

    struct NiceStruct { ... };

    /* a variable, whereever you need it */

    struct NiceStruct data;

    /* another variable of the same type, ditto */

    struct NiceStruct temp;

    /* and in some function body wot can see both you can now write */

    data = temp;

--
Chris "electric hedgehog" Dollin
C FAQs at: http://www.faqs.org/faqs/by-newsgroup/comp/comp.lang.c.html
C welcome: http://www.angelfire.com/ms3/bchambless0/welcome_to_clc.html



Sat, 06 Nov 2004 19:12:10 GMT  
 how to copy a structure of record to another structure with type,size in the menber of structure...

Quote:

> how to copy a sturcture to another structure. for example:

> struct{                        struct{
>  char a[5];                       char a[5];
>  char b[11];      =>          char b[11];
>  int c;                               int c;
> }data;                        }temp;

> thanks.

typedef struct stype {
   char a[5];
   char b[11];
   int  c;

Quote:
} stype;

stype data, temp;

....

   temp = data;

--

   Available for consulting/temporary embedded and systems.
   <http://cbfalconer.home.att.net>  USE worldnet address!



Sat, 06 Nov 2004 19:44:52 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Help with student records/structure data type

2. structure type includes incomplete structure?

3. Find size of variable size structure?

4. using incomplete structure types as opaque types

5. Reading and Writing RECORDS/STRUCTURES

6. NEWBIE: Assistance manipulating records in a structure.

7. how do u group items in a structure across records

8. Changing Records of a Structure

9. How to change records of a structure

10. ?fread fgets from a record to a structure

11. Representing binary packed record structures

12. pascals records and c structures

 

 
Powered by phpBB® Forum Software