Answer to Question 2.11

/* Copyright (c) 1990 by AT&T Bell Telephone Laboratories, Incorporated. */
/* The C++ Answer Book */
/* Tony Hansen */
/* All rights reserved. */
// print the size of a string array
#include <stream.h>
#include <string.h>

char Str[] = "a short string";

int main(int, char**)
{
    cout << "sizeof(Str)=" << sizeof(Str) << "\n";
    cout << "strlen(Str)=" << strlen(Str) << "\n";
    cout << "sizeof(\"a short string\")=" <<
	sizeof("a short string") << "\n";
    cout << "strlen(\"a short string\")=" <<
	strlen("a short string") << "\n";
    return 0;
}


Menu of Chapter 2 Answers 
Answer to Question 2.12