Reputation: 350
I am not able to understand what this declaration does in C++?
What does the 0
in parantheses do?
unsigned long num (0);
Upvotes: 1
Views: 93
Reputation: 4961
There are several types of variable initialization in C++:
int x = 0;
int x (0);
int x {0};
Your example is for the second initialization type.
Upvotes: 3
Reputation: 38193
Initializes the variable num
with 0
.
It's also a definition, not only declaration in this case..
Upvotes: 5