Code:#include<stdio.h> main() { for ( i = 0; i < 10; i++) { printf("%d", i); if ( i == 4); { break; } return 0; } }
Error message: error: 'i' undeclared (first use in this function)|
Anything?
Code:#include<stdio.h> main() { for ( i = 0; i < 10; i++) { printf("%d", i); if ( i == 4); { break; } return 0; } }
Error message: error: 'i' undeclared (first use in this function)|
Anything?
Yeah, you forgot to declare the variable named i.
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
Would be suffice?
i = o
No, a declaration of a variable includes its type. So:
Code:int i = 0;
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
Ok. Thank you.