#include <stdio.h>
int main(void)
{
int a; // 변수 a(메모리 공간 a)
int b; // 변수 b(메모리 공간 b)
return 0;
}
#include <stdio.h>
int main(void)
{
int a; // 변수 선언 시 메모리 할당, 값을 넣지 않았기에 garbage value가 담겨있음.
int b;
printf("%d \n", a);
printf("%d \n", b);
return 0;
}
/**
150511653
32766
**/
#include <stdio.h>
int main(void)
{
int a = 3;
int b = 4;
printf("The value of a is %d \n", a); // 3
printf("The value of b is %d \n", b); // 4
printf("Starting address of varibale a: %x \n", &a); // 먼저 메모리에 들어와 b보다 높은 값을 가진다.
printf("Starting address of variable b: %x \n", &b);
return 0;
}
Reference
강의: 박정민, 『C 프로그래밍』, KOCW 한국산업기술대학교, 2강
교재: 박정민, 『열혈강의 C 언어 본색 명강의가 일으키는 C 언어 기적』, 프리렉 (2011), p57-73.