Ask your own question, for FREE!
Mathematics 7 Online
OpenStudy (anonymous):

When declaring pointers in C or C++, is it prudent to assign them NULL if I'm not going to directly assign them a value as soon as I declare them?

OpenStudy (anonymous):

\[\small{\text{void *p = NULL}}\]

OpenStudy (anonymous):

I don't think it C do anything like that implicitly.You may like to read further here : http://c-faq.com/~scs/cclass/int/sx7.html

OpenStudy (anonymous):

When I used Visual C++ way back in 1998, when running in debug mode it would initialize pointers to 0xcdcdcdcd, and would set deleted pointers to 0xdddddddd. That way when your program broke you could look for pointers with these recognizable values to see which ones you were using improperly. If you leave pointers uninitialized they could be pointing to a valid memory location, and when you use it you could get a valid value, or write a value to it validly. Initializing the pointer to an invalid value won't let that happen, so your program will fail fast, which is good.

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Latest Questions
Arriyanalol: i need help
1 day ago 7 Replies 1 Medal
Arriyanalol: CONGRATS to me
1 day ago 8 Replies 2 Medals
Legomaster346: What colleges are good that are near Arab Alabama?
1 week ago 5 Replies 0 Medals
Arriyanalol: i need help
1 week ago 6 Replies 2 Medals
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!