c - What is the underlying mechanism of char array[] = "string"? -
i know in c string assignment must go through
char string[4]; strcpy(string, "aaa"); but why , how c allow
char string[] = "string"; ?
thanks in advance
char string[] = "string"; here, right length of string automatically calculated compiler there's enough room string , nul character.
char string[4]; strcpy(string, "aaa"); here strcpy may access beyond array bounds if string larger actual string capacity.
Comments
Post a Comment