Difference for a statement with or without curly braces in c++

  • Thread starter Thread starter Kishore Kumar Kadari
  • Start date Start date
K

Kishore Kumar Kadari

Guest
int D = rand() % 4;

I am getting the random variable for the above statement, but if I put curly braces as shown below

{int D = rand() % 4;}

I always get D=0. Can anyone explain how to deal with this problem in c++

Continue reading...
 
Back
Top