1

Why are there multiple ways of initializing variables in c++ instead of just one? From my knowledge you can do these:

int x = 0;
int y (2);
int c {3};

Thanks!

2
  • 6
    Past mistakes + backwards compatibility = redundancy. This is very opinion based and broad.
    – nwp
    Mar 22, 2017 at 15:03
  • @nwp, nah sure? I mean the answer should probably just be something like: "it is simply for readability" or "this one ... is quite different because it takes blablabl" :)
    – user7750295
    Mar 22, 2017 at 15:04

1 Answer 1

-2

Oh, it is because , all of datatypes are an object. They all have blind initializers, that is same as the default-constructor(initializer) of the classes.