is missing the \n at the end, so, in a Unix shell, it will print that immediately followed by the shell's prompt — not what you want.
The value “1” shows that the program has failed to execute.
No; any non-zero value does that; but there are typically OS-specific range limits, typically in the range –127 to 128. Also, the program did execute: it just encountered some error while executing.
There should be no spacing.
No, there must be no spacing.
Do not start your variable names with an underscore.
You only shouldn't do that in the global namespace. See here for the complete rules regarding identifier naming.
You omit short, long, and all the unsigned variants.
Global variables have their scope throughout the program as they can be accessed anywhere in the program.
No, a variable at file scope having external linkage is accessible throughout the program. A variable declared static at file scope is not available outside that file.
The sizes of data types you give are wrong. C++ does not mandate any particular maximum size for any data type. All C++ guarantees is that:
Your example:
is missing the
\n
at the end, so, in a Unix shell, it will print that immediately followed by the shell's prompt — not what you want.No; any non-zero value does that; but there are typically OS-specific range limits, typically in the range –127 to 128. Also, the program did execute: it just encountered some error while executing.
No, there must be no spacing.
You only shouldn't do that in the global namespace. See here for the complete rules regarding identifier naming.
You omit
short
,long
, and all theunsigned
variants.No, a variable at file scope having external linkage is accessible throughout the program. A variable declared
static
at file scope is not available outside that file.The sizes of data types you give are wrong. C++ does not mandate any particular maximum size for any data type. All C++ guarantees is that:
See here for complete details.