|
-
August 14th, 2012, 06:12 PM
#1
Passing NULL to a pointer parameter
Here is an example:
Public:
double firstCall(void *a, int *b)
{
return internalCall(a, b, NULL, NULL)
}
double secondCall(void *a, int *b, void *c, int *d)
{
return internalCall(a, b, c, d)
}
Private:
double internalCall(void *a, int *b, void *c, int *d)
{
.....
if (NULL != c)
work with c and d
}
I want to call firstCall(...) and secondCall(...) randomaly about 500 times.
I tested this code and seems it works. Is it a good idea to pass NULL as shown above? If not, what would be a good way to get expected outcome? I am just trying to reduce duplicate codes and kind of afraid if that gives a memory or program problem.
I am new to c++ and wanted to make sure this does not create a problem. I would appreciate if someone help me out.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|