call by reference pointers to array of structures
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
Re: call by reference pointers to array of structures
Why are you using array semantics to access str? Just use str->a, not &str->a.
str->a is a char, not a string. Display it with %c not %s. %s displays a NULL-terminated array of char and will not display a single char correctly.
str doesn't exist after copy() has terminated. If you need to use it after copy() has terminated, either create it in the heap (use malloc and free) or make it static.
read doesn't modify str, it can't, because you don't pass the address of str in. If it writes to str, this is undefined behaviour because str is NULL. Maybe what you should do instead is
|All times are GMT +5.5. The time now is 03:12.|