We cannot use constructors if we want that whenever a pointer is declared, it should be NULL. Am I right Sir?
if I declare student *head, *tail, where student is a class, can I make my pointers automatically make NULL using default constructor?
MRehanQadri 0
Junior Poster in Training
Recommended Answers
Jump to PostPointers are built-in types, they don't have constructors per se. If you want your ppointers to be null, make them null explicitly.
student *head = 0; student *tail = 0;
Assuming those pointers are members of another class then you can certainly use the default constructor …
All 3 Replies
deceptikon 1,790
Code Sniper Team Colleague Featured Poster
MRehanQadri 0
Junior Poster in Training
Moschops 683
Practically a Master Poster Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.