diff options
Diffstat (limited to 'src/chapter1/lesson6/uninit_var.cpp')
| -rw-r--r-- | src/chapter1/lesson6/uninit_var.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/chapter1/lesson6/uninit_var.cpp b/src/chapter1/lesson6/uninit_var.cpp new file mode 100644 index 0000000..603b8e0 --- /dev/null +++ b/src/chapter1/lesson6/uninit_var.cpp @@ -0,0 +1,12 @@ +#include <iostream> + +int main() +{ + // define an integer variable named x + int x; // this variable is uninitialized because we haven't given it a value + + // print the value of x to the screen + std::cout << x << '\n'; // who knows what we'll get, because x is uninitialized + + return 0; +} |
