How can I print the address of first character?

Destructor

Why the entire string is displayed as outcome? Why address of 1st character not getting printed? How can I print address of 1st character? Please help me.

#include <iostream>
int main()
{
    char x[6]="hello";
    std::cout<<&x[0];
}
developerbmw

The << operator on std::cout will treat a char* as a null-terminated string. You will need to cast it to a void* to print the pointer value.

Try this:

#include <iostream>

int main()
{
    char x[6] = "hello";
    std::cout << static_cast<void*>(x);
}

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How can I print the address of a bool variable?

From Dev

How can I print email address using Selenium Python

From Dev

How come I can print out each character separately but not as a whole?

From Dev

How can I print multiple character with one printf?

From Dev

How come I can print out each character separately but not as a whole?

From Java

How can I replace the first occurrence of a character in every word?

From Dev

Scala how can I uppercase first character and lowercase others

From Dev

How can I get sed to only match to the first occurrence of a character?

From Dev

How can i split a string into two on the first occurrence of a character

From Dev

How can I replace the first occurrence of a character in every word?

From Dev

How I can control the first character in a string if this is a return "\r"?

From Dev

How can I sum the first character of a column in excel?

From Dev

How can I convert the first character of a column to an uppercase for every row?

From Dev

How can I make Perl print first ten lines of a string?

From Dev

How can I print the first result of a search sequence for each iteration?

From Dev

How to print the first recurring character in a string?

From Dev

Awk print $0 print all lines of my files to the last position of column ;how I can print at first?

From Dev

How can I print this?

From Dev

How do I print a bullet character to the console?

From Dev

Can I filter the first character as String and second character as Int on an Array?

From Dev

Python: How i Can print only a particular string starting with a specific character?

From Dev

How can I print out the delimiter character and allow user to edit line while reading standard input?

From Dev

How can i print string one by character without space between them IN python2.7?

From Dev

how can I get sed to quit after the first matching address range?

From Dev

How to print array that sorted by alphabet with the first character as title?

From Dev

Yii2 how can I use a like query for first character only

From Dev

In JavaScript, how can I prevent a number from being typed as the first character in a form field?

From Dev

How can I select only the first occurance of a specific character using regex?

From Dev

How can I make UILabel or UIButton with two lines , the first with one character and the second with two characters?

Related Related

  1. 1

    How can I print the address of a bool variable?

  2. 2

    How can I print email address using Selenium Python

  3. 3

    How come I can print out each character separately but not as a whole?

  4. 4

    How can I print multiple character with one printf?

  5. 5

    How come I can print out each character separately but not as a whole?

  6. 6

    How can I replace the first occurrence of a character in every word?

  7. 7

    Scala how can I uppercase first character and lowercase others

  8. 8

    How can I get sed to only match to the first occurrence of a character?

  9. 9

    How can i split a string into two on the first occurrence of a character

  10. 10

    How can I replace the first occurrence of a character in every word?

  11. 11

    How I can control the first character in a string if this is a return "\r"?

  12. 12

    How can I sum the first character of a column in excel?

  13. 13

    How can I convert the first character of a column to an uppercase for every row?

  14. 14

    How can I make Perl print first ten lines of a string?

  15. 15

    How can I print the first result of a search sequence for each iteration?

  16. 16

    How to print the first recurring character in a string?

  17. 17

    Awk print $0 print all lines of my files to the last position of column ;how I can print at first?

  18. 18

    How can I print this?

  19. 19

    How do I print a bullet character to the console?

  20. 20

    Can I filter the first character as String and second character as Int on an Array?

  21. 21

    Python: How i Can print only a particular string starting with a specific character?

  22. 22

    How can I print out the delimiter character and allow user to edit line while reading standard input?

  23. 23

    How can i print string one by character without space between them IN python2.7?

  24. 24

    how can I get sed to quit after the first matching address range?

  25. 25

    How to print array that sorted by alphabet with the first character as title?

  26. 26

    Yii2 how can I use a like query for first character only

  27. 27

    In JavaScript, how can I prevent a number from being typed as the first character in a form field?

  28. 28

    How can I select only the first occurance of a specific character using regex?

  29. 29

    How can I make UILabel or UIButton with two lines , the first with one character and the second with two characters?

HotTag

Archive