Should I declare variables at the top of my c++ program before assigning values:
int i;
std::string x;
std::string retval;
x = "foo";
i = 5;
retval = somefunction();
Or alternatively is it correct/acceptable to assign values to variables the following way:
int i = 5;
std::string x = "foo";
std::string retval = somefunction();
I am new to c++ and I would like to know which way is accepted by the c++ community.