i have to develop a program where i have to check for a condition and assign a variable a value true or false so i am confused between these two approach.
1 bool test = true
then according to case make it false or true,
2 int flag = 1
and then change it to 0 or 1;
The bool flag "false" is equal to 0. The bool flag "true" will return "1" when typed and anything that is not zero is equivalent to true if I am making sense.
You could easily use int, I see it done all of the time, however I prefer to use bool because it is a little clearer with what the label is used for.
Using bool helps other programmers understand your code (or even yourself a lot of time later).
When they see int they don't immediately know if you actually store a number or just use it as a flag.
Also: only 0 means false, anything other than 0 means true.