Hi all,
I'm not new to programming, just new to c
Am I correct in assuming that the following two code snippets do exactly the same thing? If not, please tell! If so, why would you use one over the other...
Code:typedef struct tMyStruct{ int somenumber; } tMyStruct; void main( void ){ tMyStruct anInstance; anInstance.somenumber = 5; }Cheers,Code:typedef struct tMyStruct{ int somenumber; } tMyStruct; void main( void ){ tMyStruct *anInstance; anInstance = malloc( sizeof(tMyStruct) ); anInstance.somenumber = 5; free(anInstance); }
Pea