InterviewSolution
Saved Bookmarks
| 1. |
Consider the following C++ statements char str[] = “NO/nSMOKING”;cout<<str;1. What is the output of the above code? 2. How many bytes will be allocated in the memory for the variable str? |
|
Answer» 1. NO SMOKING. The output is in 2 lines. 2. A total of 11 bytes is used to store this string. 1 byte for \n. 1 byte for \0(The null character that is automatically appended) and 9 bytes for the remaining characters (N, 0, S, M, 0, K, l, N AND G). |
|