Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // includes and usings
- int main() {
- char * cstring = new char[6];
- cstring[0] = 'H';
- cstring[1] = 'E';
- cstring[2] = 'L';
- cstring[3] = 'L';
- cstring[4] = 'O';
- cstring[5] = '!';
- // Depending on cosmic radiation, this may work every other year.
- cout << "lenght: " << strlen(cstring) << endl;
- // Add the null byte to the end:
- cstring[5] = '\0';
- // Point in case.
- cout << "lenght: " << strlen(cstring) << endl;
- // Wait until the user figures out that "enter" closes the window.
- return cin.get();
- }
Advertisement
Add Comment
Please, Sign In to add comment