1 / 6

문자열

문자열. 목차. 문자열이란 ? 문자열의 선언 문자열의 입력과 출력 문자열 관련 함수. 문자열이란 ?. 문자를 저장하는 배열 C 언어에서는 문자를 변수 하나에 한 개밖에 저장할 수 없으므로 여러 개의 문자를 저장할 때 쓰임. 문자열의 선언. char 문자열이름 [ 문자열길이 ]; char a[10]; 이차원 이상으로도 선언 가능. 문자열의 입력과 출력. scanf (“%s”,& 문자열이름 ); printf (“%s”, 문자열이름 );. 문자열 관련 함수. string.h 에 있는 함수

navid
Download Presentation

문자열

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 문자열

  2. 목차 • 문자열이란? • 문자열의 선언 • 문자열의 입력과 출력 • 문자열 관련 함수

  3. 문자열이란? • 문자를 저장하는 배열 • C언어에서는 문자를 변수 하나에 한 개밖에 저장할 수 없으므로 여러 개의 문자를 저장할 때 쓰임

  4. 문자열의 선언 • char 문자열이름[문자열길이]; • char a[10]; • 이차원 이상으로도 선언 가능

  5. 문자열의 입력과 출력 • scanf(“%s”,&문자열이름); • printf(“%s”,문자열이름);

  6. 문자열 관련 함수 • string.h에 있는 함수 • 문자열 복사 함수 • strcpy(a,b):a문자열에 b문자열 복사 • strncpy(a,b,n):a문자열에 b문자열의 문자를 n개 복사 • strcat(a,b):a문자열 뒤에 b문자열에 붙임 • strlen(a):문자열의 길이를 알고싶을 때 • strcmp(a,b):두 문자열이 같은지 알고싶을 때 • strstr(a,b):문자열 내에서 특정문자열 검색 • stdlib.h에 있는 함수 • b=atoi(a):a문자열에 저장된 숫자를 b에 저장 • itoa(a,b,c):숫자 a를 c진법 문자열로 바꿔 b에 저장

More Related