Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8880819
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T20:13:48+00:00 2026-06-14T20:13:48+00:00

Possible Duplicate: Why is address of char data not displayed? Here is the code

  • 0

Possible Duplicate:
Why is address of char data not displayed?

Here is the code and the output:

int main(int argc, char** argv) {

    bool a;
    bool b;

    cout<<"Address of a:"<<&a<<endl;
    cout<<"Address of b:"<<&b<<endl;

    int c;
    int d;

    cout<<"Address of c:"<<&c<<endl;
    cout<<"Address of d:"<<&d<<endl;

    char e;    
    cout<<"Address of e:"<<&e<<endl;

    return 0;
}

The output:

Address of a:0x28ac67

Address of b:0x28ac66

Address of c:0x28ac60

Address of d:0x28ac5c

Address of e:

My question is:
Where is the memory address of the char? And why is it not printed?

Thank you.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T20:13:49+00:00Added an answer on June 14, 2026 at 8:13 pm

    I suspect that the overloaded-to-char * version of ostream::operator<< expects a NUL-terminated C string – and you’re passing it only the address of one character, so what you have here is undefined behavior. You should cast the address to a void * to make it print what you expect:

    cout<<"Address of e:"<< static_cast<void *>(&e) <<endl;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Check that an email address is valid on iOS What is the
Possible Duplicate: Get the IP Address of local computer Obtaining local IP address using
Possible Duplicate: How to get full URL on the address bar using PHP I
Possible Duplicate: Is there a php library for email address validation? Hi there, I
Possible Duplicate: Maximum length of the textual representation of an IPv6 address? What would
Possible Duplicate: && operator in Javascript In the sample code of the ExtJS web
Possible Duplicate: Convert some code from C++ to C I've got some code that
Possible Duplicate: Validate email address in Javascript? Can anyone help me with email validation
Possible Duplicate: Take the address of a one-past-the-end array element via subscript: legal by
Possible Duplicate: C: How come an array’s address is equal to its value? Could

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.