요약: C언어에서 Char 마지막에는 널문자가 들어간다.

 

#include<string.h>  

// H,e,l,l,o,W,o,r,l,d,\0 -> size of 11
char original_string[] = "HelloWorld";

char destination_string[10];

// run tiem error: A combination of logically incorrect actions
strcpy(destination_string, original_string);
 

'Clanguage' 카테고리의 다른 글

Clanguage)How to check if a pointer is freed already in C?  (0) 2022.10.10
Clanguage) exit(0) VS exit(1)  (0) 2022.10.10

+ Recent posts