검색결과 리스트
…™업무일지。에 해당되는 글 148건
- 2014.04.09 [smart]이재우-20140409
- 2014.04.08 [smart]이재우-20140408
- 2014.04.07 [smart]이재우-20140407
- 2014.04.04 [smart]이재우-20140404
- 2014.04.03 [smart]이재우-20140403
- 2014.04.02 [smart]이재우-20140402
- 2014.04.01 [smart]이재우-20140401
- 2014.03.31 [smart]이재우-20140331
- 2014.03.28 [smart]이재우-20140328
- 2014.03.27 [smart]이재우-20140327
글
'…™업무일지。' 카테고리의 다른 글
[smart]이재우-20140411 (0) | 2014.04.11 |
---|---|
[smart]이재우-20140410 (0) | 2014.04.10 |
[smart]이재우-20140408 (0) | 2014.04.08 |
[smart]이재우-20140407 (0) | 2014.04.07 |
[smart]이재우-20140404 (0) | 2014.04.04 |
설정
트랙백
댓글
글
'…™업무일지。' 카테고리의 다른 글
[smart]이재우-20140410 (0) | 2014.04.10 |
---|---|
[smart]이재우-20140409 (0) | 2014.04.09 |
[smart]이재우-20140407 (0) | 2014.04.07 |
[smart]이재우-20140404 (0) | 2014.04.04 |
[smart]이재우-20140403 (0) | 2014.04.03 |
설정
트랙백
댓글
글
'…™업무일지。' 카테고리의 다른 글
[smart]이재우-20140409 (0) | 2014.04.09 |
---|---|
[smart]이재우-20140408 (0) | 2014.04.08 |
[smart]이재우-20140404 (0) | 2014.04.04 |
[smart]이재우-20140403 (0) | 2014.04.03 |
[smart]이재우-20140402 (0) | 2014.04.02 |
설정
트랙백
댓글
글
'…™업무일지。' 카테고리의 다른 글
[smart]이재우-20140408 (0) | 2014.04.08 |
---|---|
[smart]이재우-20140407 (0) | 2014.04.07 |
[smart]이재우-20140403 (0) | 2014.04.03 |
[smart]이재우-20140402 (0) | 2014.04.02 |
[smart]이재우-20140401 (0) | 2014.04.01 |
설정
트랙백
댓글
글
'…™업무일지。' 카테고리의 다른 글
[smart]이재우-20140407 (0) | 2014.04.07 |
---|---|
[smart]이재우-20140404 (0) | 2014.04.04 |
[smart]이재우-20140402 (0) | 2014.04.02 |
[smart]이재우-20140401 (0) | 2014.04.01 |
[smart]이재우-20140331 (0) | 2014.03.31 |
설정
트랙백
댓글
글
'…™업무일지。' 카테고리의 다른 글
[smart]이재우-20140404 (0) | 2014.04.04 |
---|---|
[smart]이재우-20140403 (0) | 2014.04.03 |
[smart]이재우-20140401 (0) | 2014.04.01 |
[smart]이재우-20140331 (0) | 2014.03.31 |
[smart]이재우-20140328 (0) | 2014.03.28 |
설정
트랙백
댓글
글
'…™업무일지。' 카테고리의 다른 글
[smart]이재우-20140403 (0) | 2014.04.03 |
---|---|
[smart]이재우-20140402 (0) | 2014.04.02 |
[smart]이재우-20140331 (0) | 2014.03.31 |
[smart]이재우-20140328 (0) | 2014.03.28 |
[smart]이재우-20140327 (0) | 2014.03.27 |
설정
트랙백
댓글
글
2014. 03. 31 수업 및 과제
1 정리 중입니다.
'…™업무일지。' 카테고리의 다른 글
[smart]이재우-20140402 (0) | 2014.04.02 |
---|---|
[smart]이재우-20140401 (0) | 2014.04.01 |
[smart]이재우-20140328 (0) | 2014.03.28 |
[smart]이재우-20140327 (0) | 2014.03.27 |
[smart]이재우-20140326 (0) | 2014.03.26 |
설정
트랙백
댓글
글
'…™업무일지。' 카테고리의 다른 글
[smart]이재우-20140401 (0) | 2014.04.01 |
---|---|
[smart]이재우-20140331 (0) | 2014.03.31 |
[smart]이재우-20140327 (0) | 2014.03.27 |
[smart]이재우-20140326 (0) | 2014.03.26 |
[smart]이재우-20140325 (0) | 2014.03.25 |
설정
트랙백
댓글
글
2014. 03. 27 수업 및 과제
1 포인터의 이해 p278
- * (asterisk)
2 포인터와 배열의 관계 p290
int *p;
int arr[3];
Type
Name
address
int *
p
주소 값 변경 가능
Int [ ]
arr
주소 값 변경 불가능
1. 포인터를 배열로 쓰는 것이 가능 예) P[]
2. 배열을 포인터로 쓰는 것이 가능 예) *arr
3. 메모리의 주소 값을 나타냄
4. 포인터는 메모리 주소 값 변경이 가능 배열은 불가능
arr[1]= = *(arr+1)
arr[i]= =*(arr+i)
int arr[3]={11, 22, 33};
int * ptr=arr;
printf(“%d %d %d \n”, *ptr, *(ptr+1), *(ptr+2));
Type
Name
Address
int *
ptr
주소 값 변경 가능
Int [ ]
arr
주소 값 변경 불가능
1. 배열의 이름 arr[1]과 포인터 변수*(arr+1)는 상수냐 변수냐의 차이
일 뿐 동일함
2. *ptr, *(ptr+1), *(ptr+2) = arr[0], arr[1], arr[2] 같다
char str1[]=”My String”;
char *str2=”My String”;
변수 형태의 문자열
내용 변경 가능
상수 형태의 문자열
내용 변경 불가능
컴퓨터나 컴파일러에 따라 다를 수 있으므로 주의
해야 한다.
[예제1]
#include
<stdio.h>
int
main()
{
char str1[]="My String";
char * str2="Your String"; //
내용 변경 불가능
printf("%s %s \n", str1, str2);
str2="Our String"; //
가리키는 대상 변경
printf("%s %s \n", str1, str2);
str1[0]='X';
//
문자열 변경 가능
str2[0]='X'; //
주의} 에러 문자열 변경 실패
printf("%s %s \n", str1, str2);
return 0;
}
const char *
[예제1]
#include
<stdio.h>
int
main()
{
char str1[]="My String";
const char * str2="Your String"; //const
를 삭제 하면 정상적으로 값이 변경
printf("%s %s \n", str1, str2);
str2="Our String";
printf("%s %s \n", str1, str2);
str1[0]='X';
str2[0]='X'; //
에러 const char * 값을 바꿀 수 없다.
printf("%s %s \n", str1, str2);
return 0;
}

[예제2]
#include
<stdio.h>
//unsigned int Mystrlenth_max(char *);
unsigned
int Mystrlenth_max(const char *); // const char *
바꿀 수 없음을 뜻함
int
main()
{
char * cpStr = "12345";
unsigned int uiRet;
// *cpStr
=
'a';
uiRet=Mystrlenth_max("test");
printf("%d \n",uiRet);
printf("%d \n",Mystrlenth_max("test"));
return 0;
}
//unsigned int Mystrlenth_max(char *cpStr)
unsigned
int Mystrlenth_max(const char *cpStr) // const char *
바꿀 수 없음을 뜻함
{
unsigned int uiCnt=0;
// *cpStr
=
'A';
while(0 != *cpStr)
{
++cpStr;
++uiCnt;
}
return uiCnt;
}

[예제3]
문자를 입력 받아 APPLE 문자 뒤에 저장 하기
#include
<stdio.h>
int
main()
{
char caText[256]="APPLE";
scanf("
문자입력:%s"
, caText+5);
printf("%s\n", caText);
return 0;
}

[예제]
#include
<stdio.h>
int
main()
{
int iNum0=31;
int iNum1=21;
int iNum2=51;
int iNum3=74;
int iNum4=63;
int *iaArr[5];
iaArr[0]=&iNum1;
iaArr[1]=&iNum0;
iaArr[2]=&iNum2;
iaArr[3]=&iNum4;
iaArr[4]=&iNum3;
printf("%d\n", *iaArr[0]);
printf("%d\n", *iaArr[1]);
printf("%d\n", *iaArr[2]);
printf("%d\n", *iaArr[3]);
printf("%d\n", *iaArr[4]);
return 0;
}

Code
영역에 저장 -> "Simple"
, "String", "Array"
실제로는 "Simple"
, "String", "Array"
는 주소를 가지고 있다.
[예제]
#include
<stdio.h>
int
main()
{
char * strArr[3]={"Simple", "String", "Array"};
printf("%s \n", strArr[0]);
printf("%s \n", strArr[1]);
printf("%s \n", strArr[2]);
return 0;
}

#include
<stdio.h>
void
ShowArayElem(int * , int);
int
main()
{
int arr1[3]={1,2,3};
int arr2[5]={4,5,6,7,8};
ShowArayElem(arr1, sizeof(arr1) / sizeof(int)); //int 4byte
ShowArayElem(arr2, sizeof(arr2) / sizeof(int));
return 0;
}
void
ShowArayElem(int * ipParam, int iLen)
{
int iNum;
int iNum2;
iNum2=iLen;
for(iNum=0; iNum<iLen; iNum++)
{
printf("%d", ipParam[iNum]);
}
printf("\n");
}

int *p;
int arr[3];
Type
Name
address
int *
p
주소 값 변경 가능
Int [ ]
arr
주소 값 변경 불가능
1. 포인터를 배열로 쓰는 것이 가능 예) P[]
2. 배열을 포인터로 쓰는 것이 가능 예) *arr
3. 메모리의 주소 값을 나타냄
4. 포인터는 메모리 주소 값 변경이 가능 배열은 불가능
arr[1]= = *(arr+1)
arr[i]= =*(arr+i)
int arr[3]={11, 22, 33};
int * ptr=arr;
printf(“%d %d %d \n”, *ptr, *(ptr+1), *(ptr+2));
Type
Name
Address
int *
ptr
주소 값 변경 가능
Int [ ]
arr
주소 값 변경 불가능
1. 배열의 이름 arr[1]과 포인터 변수*(arr+1)는 상수냐 변수냐의 차이
일 뿐 동일함
2. *ptr, *(ptr+1), *(ptr+2) = arr[0], arr[1], arr[2] 같다
char str1[]=”My String”;
char *str2=”My String”;
변수 형태의 문자열
내용 변경 가능
상수 형태의 문자열
내용 변경 불가능
컴퓨터나 컴파일러에 따라 다를 수 있으므로 주의
해야 한다.
#include
<stdio.h>
int
main()
{
char str1[]="My String";
char * str2="Your String"; //
내용 변경 불가능
printf("%s %s \n", str1, str2);
str2="Our String"; //
가리키는 대상 변경
printf("%s %s \n", str1, str2);
str1[0]='X';
//
문자열 변경 가능
str2[0]='X'; //
주의} 에러 문자열 변경 실패
printf("%s %s \n", str1, str2);
return 0;
}
#include
<stdio.h>
int
main()
{
char str1[]="My String";
const char * str2="Your String"; //const
를 삭제 하면 정상적으로 값이 변경
printf("%s %s \n", str1, str2);
str2="Our String";
printf("%s %s \n", str1, str2);
str1[0]='X';
str2[0]='X'; //
에러 const char * 값을 바꿀 수 없다.
printf("%s %s \n", str1, str2);
return 0;
}
#include
<stdio.h>
//unsigned int Mystrlenth_max(char *);
unsigned
int Mystrlenth_max(const char *); // const char *
바꿀 수 없음을 뜻함
int
main()
{
char * cpStr = "12345";
unsigned int uiRet;
// *cpStr
=
'a';
uiRet=Mystrlenth_max("test");
printf("%d \n",uiRet);
printf("%d \n",Mystrlenth_max("test"));
return 0;
}
//unsigned int Mystrlenth_max(char *cpStr)
unsigned
int Mystrlenth_max(const char *cpStr) // const char *
바꿀 수 없음을 뜻함
{
unsigned int uiCnt=0;
// *cpStr
=
'A';
while(0 != *cpStr)
{
++cpStr;
++uiCnt;
}
return uiCnt;
}
#include
<stdio.h>
int
main()
{
char caText[256]="APPLE";
scanf("
문자입력:%s"
, caText+5);
printf("%s\n", caText);
return 0;
}
#include
<stdio.h>
int
main()
{
int iNum0=31;
int iNum1=21;
int iNum2=51;
int iNum3=74;
int iNum4=63;
int *iaArr[5];
iaArr[0]=&iNum1;
iaArr[1]=&iNum0;
iaArr[2]=&iNum2;
iaArr[3]=&iNum4;
iaArr[4]=&iNum3;
printf("%d\n", *iaArr[0]);
printf("%d\n", *iaArr[1]);
printf("%d\n", *iaArr[2]);
printf("%d\n", *iaArr[3]);
printf("%d\n", *iaArr[4]);
return 0;
}
Code
영역에 저장 -> "Simple"
, "String", "Array"
"Simple"
, "String", "Array"
는 주소를 가지고 있다.
#include
<stdio.h>
int
main()
{
char * strArr[3]={"Simple", "String", "Array"};
printf("%s \n", strArr[0]);
printf("%s \n", strArr[1]);
printf("%s \n", strArr[2]);
return 0;
}
#include
<stdio.h>
void
ShowArayElem(int * , int);
int
main()
{
int arr1[3]={1,2,3};
int arr2[5]={4,5,6,7,8};
ShowArayElem(arr1, sizeof(arr1) / sizeof(int)); //int 4byte
ShowArayElem(arr2, sizeof(arr2) / sizeof(int));
return 0;
}
void
ShowArayElem(int * ipParam, int iLen)
{
int iNum;
int iNum2;
iNum2=iLen;
for(iNum=0; iNum<iLen; iNum++)
{
printf("%d", ipParam[iNum]);
}
printf("\n");
}
'…™업무일지。' 카테고리의 다른 글
[smart]이재우-20140331 (0) | 2014.03.31 |
---|---|
[smart]이재우-20140328 (0) | 2014.03.28 |
[smart]이재우-20140326 (0) | 2014.03.26 |
[smart]이재우-20140325 (0) | 2014.03.25 |
[smart]이재우-20140324 (1) | 2014.03.24 |
RECENT COMMENT