I have a prob in my code which am trying to debug from past 2 days. Can i get help on this.
i have a structure declared in header file
Code:
typedef struct
{
char a;
int b;
} struct2;
This is declared in my current pgm where struct2 *test is similar to struct2
typedef struct
{
char a;
int b;
int c;
struct2 *test;
} struct1;
int copy(struct1* stats);
int main (int argc, char *argv[])
{
struct1 stats;
copy(&stats);
return 0;
}
int copy(struct1* stats)
{
struct2* str= NULL;
int num = 0;
printf("In copy funct \n");
if (read(str, &num) != 0)
{
printf("Error reading stats.\n");
return -1;
}
printf("Address of str at copy funt %u \n", str);
printf("a %s \n",&str[0]->a);
printf("b %d \n",&str[0]->b);
stats->c = num;
stats->test = str;
return 0;
}
Thanks,
Sanjana

