static read-only literal: char x[]="abc"; shorthand for char x[4] = {0x61,0x62,0x63,0}; static/auto: char x[30] = "hello"; or char x[30]; strcpy(x, "hello"); or char x[] = "hello" dynamic: char *x; x = malloc(30); strcpy(x, "hello"); Making string literals const is a C++ idiom and not part of any C standard declaration; intialization; assignment
No comments:
Post a Comment