how to copy elemnts of two different structrue elements
iam not able to copy elemnts of one structure into another different structure
Iam givivng an example to explain what i Want ???????..
I have a structure for Example:-
/**********this is main file called main.c************/
#include"heade2.h"/*********see description below for the header2.h*********/
typedef enum(init,initkt)actiontype;
struct str1
{
int no
char * str;
actiontype action;
};
main()
{
my_client my_objects; /******see header2.h below*********/
str1 * obj ;
copy_structure(&myobjects,obj);
/**********here is the question how the copy strcutre will copy every element **/
/*******how will i allocate the memory to every elemt os structure using malloc*/
/***there ars some fucntion which uses str1****/
}
/**********main.c ends here ********************?
/*now again there is another structure in a header file header.h*/
struct str2
{
int no ;
char *str;
}
/*********** header.h ends here************/
/********now again i have another header file called header2.h*****/
typdef struct str2 my;
my my_client;
/**********header2.h ends here and i include this in main **********/
/******** i cannot shift the position of structure str1 becuause ther are amny dependencis it has in the main and the source code has been build like that so i have to follow the same organiztion of the source code *********/
|