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!

  • 6
    Past mistakes + backwards compatibility = redundancy. This is very opinion based and broad. – nwp Mar 22 '17 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" :) –  Mar 22 '17 at 15:04

1 Answers1

-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.

G.Andrei
  • 1
  • 2