Message from C, C++ discussions

December 2019

— Just plug it into the compiler and see the results

— 

#include<iostream>
int main() {
int first = 0, second = 0;
std::cin >> first >> second;
std::cout << first + second;
}

— I really want something to explicitly tell the compiler that a variable is uninitialized

— Like what?

— int a = void;

— Something like that

— And why do you need that?

— 

[[uninitialised]] int a;

— That's another option

— Doing that, you explixitly tell the compiler that the variable is uninitialized on purpose

— I think that variables must be initialized always

— Yes, I understand
Why do you need uninitialized variable?