Thread: Char pointer

  1. #1
    Registered User
    Join Date
    Sep 2014
    Posts
    16

    Char pointer

    Why does "cout" not print the address of a char variable?



    For example:

    The following code for an integer variable prints the address of the integer variable.

    int Integer;
    int* PtrInteger = &Integer;
    *PtrInteger = 10;
    cout << PtrInteger << endl;


    The same code for a char variable does not print the adress of the char variable, it just prints some stange characters.


    char Char;
    char* PtrChar = &Char;
    *PtrChar = 'S';
    cout << PtrChar << endl;


    What is the reason of this?
    Thanks a lot ...








  2. #2

  3. #3
    Registered User
    Join Date
    Sep 2014
    Posts
    16
    Thank you for the links.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 2
    Last Post: 12-02-2012, 05:25 AM
  2. Read char by char into two-dimensional array pointer.
    By 'Serj Codito in forum C++ Programming
    Replies: 5
    Last Post: 09-08-2012, 09:47 AM
  3. About char pointer to char array
    By homoon in forum C Programming
    Replies: 3
    Last Post: 05-27-2012, 03:26 AM
  4. Copy char array to char pointer
    By Suseela in forum C Programming
    Replies: 9
    Last Post: 08-06-2009, 12:49 PM
  5. pointer to pointer that points to a char array
    By steve1_rm in forum C Programming
    Replies: 2
    Last Post: 01-14-2009, 12:03 AM