1.6 Uninitialized variables and undefined behavior

주홍영·2022년 3월 10일
0

Learncpp.com

목록 보기
18/199

https://www.learncpp.com/cpp-tutorial/uninitialized-variables-and-undefined-behavior/

Undefined behavior

uninitialized variable의 value를 사용하는 것이 Undefined behavior의 첫 예시다.
Undefined behavior(UB)

Quiz

Q1 What is an uninitialized variable? Why should you avoid using them?

An uninitialized variable is a variable that has not been given a value by the program (generally through initialization or assignment). Using the value stored in an uninitialized variable will result in undefined behavior.

Q2 What is undefined behavior, and what can happen if you do something that exhibits undefined behavior?

Undefined behavior is the result of executing code whose behavior is not well defined by the language. The result can be almost anything, including something that behaves correctly.

profile
청룡동거주민

0개의 댓글