|
|
|||||
|
Get the Ebook
C Tutorial
Source Code
Function Reference
|
Be careful when storing pointers inside unionsThis tip submitted by singam kiran reddy on 2006-10-26 00:54:17. It has been viewed 17965 times.Rating of 6.4 with 141 votes Be carefull while using pointers inside unions. Take following scenario union { char *a; int *b; } c; c.a=(char*)malloc(sizeof(char)); c.b=(int*)malloc(sizeof(int)); Here memory leak will occur because in future you can not get the address stored in a to free it! More tips Help your fellow programmers! Add a tip!
Want to become a C++ programmer? The Cprogramming.com ebook, Jumping into C++, will walk you through it, step-by-step. Get Jumping into C++ today!
Popular pages
Custom Search
|
||||