Does memory allocated for built-in types (in particular int, float and double) with the new operator initialize them to 0 (or 0.0, as the case may be)? Just trying to remember. (I seem to remember that new invokes a constructor even for the built-in types, but i'm not sure).
mindgames 0 Newbie Poster
Recommended Answers
Jump to PostNo.
Proof:
int main() { int* n = new int; cout << *n << "\n"; }
All 4 Replies
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
mindgames 0 Newbie Poster
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
mindgames 0 Newbie 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.