Yahoo Answers is shutting down on 4 May 2021 (Eastern Time) and the Yahoo Answers website is now in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

what is the value of sizeof(const char*) in C++?

sizeof (char) is 1 but what is the value of sizeof(const char*) in c++?

4 Answers

Relevance
  • 1 decade ago
    Favourite answer

    the size of the pointer itself is four bytes, while the size of the char it's pointing to is only one.

    const char* c = "Hello!";

    cout << sizeof(c); // 4

    cout << sizeof(*c); // 1

    cout << endl;

  • ?
    Lv 4
    5 years ago

    Sizeof Char

  • ?
    Lv 4
    4 years ago

    Size Of Char In C

  • Anonymous
    5 years ago

    For the best answers, search on this site https://shorturl.im/ax1E4

    well a char is only ONE character. to copy one char to another a=b or a='Z' (single quotes) strcat() will concatenate to char arrays together. char str1[100] = "Hello"; strcat(str1, " world!"); puts(str1); puts out "Hello world!" btw that is C and not C++, char and strcat are for C strings not C++, but they all work in either anyway.

Still have questions? Get answers by asking now.