Hi,
I have 2 C++ basic questions:
1. I understood that using this:
for(int i=0; i<5; ++i)
is better than using this:
for(int i=0; i<5; i++)
the first only increments and the second assign and incremement
can someone please give me a deeper explanation regarding this issue?
2. When I use unsigned int and do the following:
unsigned int x = -1;
what will happen?
what I really want to know is this:
If I defined a variable as unsigned int and it is an output parameter and the one using it will put there a negative value by mistake, what will happen
Should I check that the out param is not < 0?
For example
main
{
unsigned int x_array[5];
....
// iterating on x_array
for(int i=0 ; i<5 ; ++i)
{
//do I have to check if x_array[i] < 1
//or can I be sure that the value is positive ?
}
}
Thanks
Avi
