Quote:
Originally posted by fkheng
wow, some kind of debate, hehe, but wat i was taught before was that if HELLO has 5 characters, so declaring it as
char temp[5];
strcpy(temp, "HELLO");
so temp[5] actually stores 6 items, 5 of them are characters which make up HELLO, and the remaining one stores the '\0' bit, correct me if i am wrong, is this correct?
In a word: No. Your array will only ever be 5 characters long, because that's the size you declared it as. Sure, it may add a null to whatever is beyond the end of your array, but that is just that: beyond the end of your array.