November 30, 2009 9:45 pm
Keywords Keywords are reserved to the compiler for use by the language. These keywords are part of the C++ language construct. You cannot define classes, variables, or functions that have these keywords as their names as it will not even alow you to compile. This list contains the ANSI-C++ Standard though it doesnt mean that they are 100% portable. Also, please note that this list does not contain all of the C++ Keywords, but the main ones. auto // auto break // break out of a loop case // used with switch catch // used with try() for error handling char // typename 'char' class // datatype const // constant continue // continue loop default // used with switch delete // C++ free() do // loop double // typename 'double' else // in cunjunction with if() enum // enumaration extern // external, not to instantiate float // typename 'float' for // loop friend // a friend goto // skip-to somewhere in code - bad if // if int // typename 'int' long // typename 'long' mutable // ?? new // C++ malloc operator // for overloading operators private // in cunjunction with class protected // in cunjunction with class public // in conjunction with class register // manually register in memory return // return from function short // typename 'short' signed // both +/- allowed sizeof // sizeof variable static // global struct // datatype switch // kind of like nested if()'s template // template this // pointer to self throw // used with try() typedef // define a new type union // only one data var at a time unsigned // + only allowed virtual // polymorphysm void // nothing volatile // volatile while // loop That's pretty much all the keywords I can think up of... for now.Please Rate this Code: Comments for: Keywords Cory Sanchez [cosez@earthlink.net] Posted: 2 times. says: Also notice, all keywords are not captalized and they are case-sensitive. If you would try and use the switch keyword and typed in Switch(choice){//code} it would not work. Add Comment: Name: Email:
auto // auto break // break out of a loop case // used with switch catch // used with try() for error handling char // typename 'char' class // datatype const // constant continue // continue loop default // used with switch delete // C++ free() do // loop double // typename 'double' else // in cunjunction with if() enum // enumaration extern // external, not to instantiate float // typename 'float' for // loop friend // a friend goto // skip-to somewhere in code - bad if // if int // typename 'int' long // typename 'long' mutable // ?? new // C++ malloc operator // for overloading operators private // in cunjunction with class protected // in cunjunction with class public // in conjunction with class register // manually register in memory return // return from function short // typename 'short' signed // both +/- allowed sizeof // sizeof variable static // global struct // datatype switch // kind of like nested if()'s template // template this // pointer to self throw // used with try() typedef // define a new type union // only one data var at a time unsigned // + only allowed virtual // polymorphysm void // nothing volatile // volatile while // loop
That's pretty much all the keywords I can think up of... for now.Please Rate this Code:
Switch(choice){//code}