W
Waxhead
Note: I'm not experienced with newsgroups so my apologies if I've done
any errors.
In the function dosomething() I would like to skip the workingstuffptr
"workaround". is there any way I can use stuffptr directly without
using a temp?
Thanks in advance.
#include <stdio.h>
#include <stdlib.h>
typedef struct _stuff
{
unsigned int value;
} STUFF, *LPSTUFF;
void dosomething(LPSTUFF *stuffptr)
{
STUFF *workingstuffptr;
workingstuffptr = *stuffptr;
workingstuffptr->value = 5;
stuffptr->id = 5; /* Can't be done */
}
int main(void)
{
LPSTUFF somestuff;
somestuff = malloc(sizeof(STUFF));
if(!somestuff)
return 5;
somestuff->value = 10;
dosomething(&somestuff);
printf("Value = %d\n",somestuff->value);
return 0;
}
any errors.
In the function dosomething() I would like to skip the workingstuffptr
"workaround". is there any way I can use stuffptr directly without
using a temp?
Thanks in advance.
#include <stdio.h>
#include <stdlib.h>
typedef struct _stuff
{
unsigned int value;
} STUFF, *LPSTUFF;
void dosomething(LPSTUFF *stuffptr)
{
STUFF *workingstuffptr;
workingstuffptr = *stuffptr;
workingstuffptr->value = 5;
stuffptr->id = 5; /* Can't be done */
}
int main(void)
{
LPSTUFF somestuff;
somestuff = malloc(sizeof(STUFF));
if(!somestuff)
return 5;
somestuff->value = 10;
dosomething(&somestuff);
printf("Value = %d\n",somestuff->value);
return 0;
}