hi everybody! i'm a beginner in c++ and when i was studying i found a problem. I didn't understand what for is the int command if someone of you could please anwer this i'll be very gratefull
It defines a variable of type integer, which stores positive and negative whole numbers within a specific limit. That limit is machine dependent but typically it's from -2^31 up to +2^31-1. ^ means "to the power of", so that's -2147483648 to +2147483647 (notice it's not symmetrical, that's because there's only one representation for zero). Examples: int foo; // defines an integer variable called foo with an undefined initial value. You have to watch uninitialised variables carefully to avoid some possibly difficult to find bugs (e.g. the program works in a "debug" compile but not in a "release" compile, which is VERY annoying!). int bar=-27; // defines an integer bar containing the initial value of -27. Always initialise variables! Even if just to zero. int quux=9999999999; // invalid, because 9,999,999,999 is greater than the maximum value you can store (2,147,483,647). You should get an error, or at least a warning, if you try to compile this one. int gronk=3.14159265; // invalid, because pi isn't a whole number. This may or may not throw an error; if not, it will assign 3 to gronk. You may get a compiler warning.
[COMMENT]I would not like to post if your Title does not speak what it contains inside and so try giving Good Titles.[/COMMENT]