I have a char pointer which would be used to store a string. It is used later in the program.
I have declared and initialized like this:
char * p = NULL;
I am just wondering if this is good practice. I'm using gcc 4.3.3.
Yes, it's good idea. Google Code Style recommends:
Initialize pointers by NULL
, int
's by 0 and float
's by 0.0 -- just for better readability.
int i = 0;
double x = 0.0;
char* c = NULL;