online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code   
Language
#include <stdio.h> int main(void) { int num = 50; // num 변수 하나만 존재 int *pnum; // 정수형 포인터 선언 pnum = &num; // pnum이 num의 주소를 가리키도록 초기화 // 1) *(pnum) 은 pnum이 가리키는 주소(=num)의 값을 그대로 출력 printf("*(pnum) = %d\n", *(pnum)); // 50 // 2) *(pnum++) 은 “후위 연산자”이므로 // (a) *(pnum)를 먼저 평가 → 50 출력 // (b) 그 뒤에 pnum = pnum + 1; (주소가 다음 int 크기만큼 증가) printf("*(pnum++) = %d\n", *(pnum++)); // 50 // 지금 pnum은 num 바로 다음 메모리(정의되지 않은 영역)를 가리키고 있습니다. // 3) *(++pnum) 은 “전위 연산자”이므로 // (a) pnum = pnum + 1; → 다시 한 번 다음 int 크기만큼 증가 // (b) *(pnum)를 평가 → 정의되지 않은(쓰레기) 값 printf("*(++pnum) = %d\n", *(++pnum)); // 예측 불가 (쓰레기 값) return 0; }

Compiling Program...

Command line arguments:
Standard Input: Interactive Console Text
×

                

                

Program is not being debugged. Click "Debug" button to start program in debug mode.

#FunctionFile:Line
VariableValue
RegisterValue
ExpressionValue