How do I clear an array in C?
问题 char x [1000]; x = 'hello'; What would I use to clear the contents of x ? I'm not able to re-initialise it, use strcpy(x, '/0') or free() . 回答1: You cannot assign anything to an array, which your variable x is. So therefore anything that starts with x = is wrong. Secondly 'hello' is not a string, it is a multicharacter literal which is of type int , so this doesn’t make sense either. A string literal is enclosed by " while character (or multicharacter) literals are enclosed by ' . So if you