Im trying to figure out how many elements are in the array:
char day[] = "Tuesday";
and if the array is terminated by a null character. and please explain why
Im trying to figure out how many elements are in the array:
char day[] = "Tuesday";
and if the array is terminated by a null character. and please explain why
Whenever you write a literal string, it is always implicitly terminated by a null character.
Tuesday is 7 letters, + \0 makes 8.
It is too clear and so it is hard to see.
A dunce once searched for fire with a lighted lantern.
Had he known what fire was,
He could have cooked his rice much sooner.
Code:cout << sizeof( day ) << endl;
"I am probably the laziest programmer on the planet, a fact with which anyone who has ever seen my code will agree." - esbo, 11/15/2008
"the internet is a scary place to be thats why i dont use it much." - billet, 03/17/2010