c - What is the recommended procedure for initializing char arrays? -


char label[10] = "me" works, , change value of label, i'd have like:

char * temp = "not me"; strcpy(label,temp); 

my question why invalid?

char label[] = "me"; label = "not me"; 

because arrays not assignable. can create them, can change content, array cannot modified refer new chunk of memory.


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

qt - Errors in generated MOC files for QT5 from cmake -