press any key to continue question 2 significance

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: < c+1 << endl; Expected output Actual output Input a letter: d The next letter in ASCII is: e Input a letter: d The next letter in ASCII is: 101 Press any key to continue . . . Press any key to continue . . . Question 2. Significance of the null character '\0' Complete the code below: • Output a cstring char by char void my_cout(const char s, int n) { int i=0; while (_______________) { cout << s[i]; i++; } } /* Output the cstring s char by char */ The above explains how '\0' in cstrings are actually applied in most operations. • Display / Remove the last character in a cstring (ie. The character before '\0') (i) void display_last(const char s, int n) { } Note: (ii) void remove_last(const char s, int n) { } In real practice, we often pass cstrings as char *s or const char *s instead of char s[ ] or const char s[ ]. We will know more in our next lesson. 3/3...
View Full Document

This document was uploaded on 10/15/2013.

Ask a homework question - tutors are online