I want to have \0 as one of my array (char type) element in my C/C++ code but not the last one.
I am doing this.
char arr[10] ; //array declaration
//initializing the array
arr[0] = 'a' ;
arr[1] = '\0' ;
arr[2] = 's' ;
When i try printing these array elements, i get some symbolic stuff as output for a[1].
I guess 0 is converted to char. Is that so ?
If yes, can't i have \0 anyhow in my array before the termination ?
'/0' is not a null character. Escaping uses a backslash: '\0'.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With