im not looking for anyone to debug it...i just want someone to look over the syntax, etc, and make sure im allocating and releasing memory in the correct way
Type: Posts; User: surfxtc79
im not looking for anyone to debug it...i just want someone to look over the syntax, etc, and make sure im allocating and releasing memory in the correct way
my structure definition:
struct mystruct
{
char *name;
char id[10];
int val;
};
this abridged version of the calls from main
.
.
.
.
int sel=0;
char buf1[80],buf2[80],buf3[80];
char *ret1;
These are the functions that allocate and free memory:
// Question 8
void cop_setvals(struct mystruct *ps,char *name,const char *id,int val){
ps->name=name;
strcpy(ps->id,id);...
Im having a problem when I try to free memory that has been previosly allocated. Ive checked to ensure the same address is being passed all the way through. I've attached the project and workspace...
thanks, everything is working fine now...the function is already prototyped in the header file...the variables are being read in from console window....sorry to leave out so much...the project is...
and the declaration should be:
struct mystruct *pdemo;
in the main function
struct mystruct
{
char *name;
char id[10];
int val;
};
Im just learning C and I need help. Im trying to allocate memory for a structure call mystruct, initialize the values for the strucutre and then return a pointer to the allocated memory:
void...