Skip to content

Commit 0b01bef

Browse files
authored
Create source
자료구조 3주차 과제 2번 문제 ap2.c 소스코드이다.
1 parent 118c348 commit 0b01bef

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

source

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#include<stdio.h>
2+
#include<stdlib.h>
3+
int main()
4+
{
5+
int list[5];
6+
int *plist[5];
7+
8+
list[0] = 10;
9+
list[1] = 11;
10+
11+
plist[0] = (int*)malloc(sizeof(int)); // plist[0]에다가 int형 크기 많큼 동적할당 해준다.
12+
13+
printf("list[0] \t=%d\n",list[0]); // list[0]의 값을 출력한다.
14+
printf("address of list \t= %p\n", list); // list의 주소를 출력한다.
15+
printf("address of list[0] \t = %p\n",&list[0]); // list[0]의 주소를 출력한다.
16+
printf("address of list + 0 \t= %p\n",list+0); // list + 0 의 주소를 출력한다.
17+
printf("address of list + 1 \t= %p\n",list+1); // list + 1 의 주소를 출력한다.
18+
printf("address of list + 2 \t= %p\n",list+2); // list + 2 의 주소를 출력한다.
19+
printf("address of list + 3 \t= %p\n",list+3); // list + 3 의 주소를 출력한다.
20+
printf("address of list + 4 \t= %p\n",list+4); // list + 4 의 주소를 출력한다.
21+
printf("address of list[4] \t= %p\n ",&list[4]); // list [4] 의 주소를 출력한다.
22+
23+
printf("--------------------------------------------------------------------------\n\n");
24+
25+
printf("[----- [김 윤 희] [2018038014] -----]\n\n");
26+
27+
28+
}

0 commit comments

Comments
 (0)