Home > Back-end >  C: what is the number of the red line part of the figure? Should not be the letter? If I want to out
C: what is the number of the red line part of the figure? Should not be the letter? If I want to out

Time:10-29

CodePudding user response:

The output is the ASCII characters, if you change to cout<(char) (* * p + 1); Is the character of

CodePudding user response:

reference 1st floor Italink response:
output is the ASCII characters, if you change to cout<(char) (* * p + 1); Is the character

This is the use of coercion?

CodePudding user response:

reference 2 floor Lv. 100 response:
Quote: refer to 1st floor Italink response:
output is the ASCII characters, if you change to cout<(char) (* * p + 1); Is the character

This is the use of coercion?

Not just a simple type conversion

CodePudding user response:

Why some output is a digital, but some output is ascll code?

CodePudding user response:

references 4 floor Lv. 100 response:
why some output is a digital, but some output is ascll code?

A typo, is letter...

CodePudding user response:

reference 5 floor Lv. 100 response:
Quote: reference 4 floor Lv. 100 response:
why some output is digital, and some of the output is ascll code?

A typo, is letter...

It would have to ask cout, why I one character at a time, you give me the output a number? Cout, unlike the scanf of C language, has strict control format, use cout, cin, does not need to care about the format of the variables, use is good, but it tends to have a deviation,
Therefore, when need strict format control, it is best to use the scanf, printf

CodePudding user response:

And the * p should not address too? Why would the compiler output is a string?

CodePudding user response:

Char * some special, will be treated as string output

CodePudding user response:

See, thank you bosses

CodePudding user response:

That is why digital because
Char and int addition, the result is an int,
coutThis sentence is
Cout. Operator<(p);
Cout have multiple overloaded operator, when p is char * nature calls to cout. Operator (char *) output string
When cout<* p + 1, because the char + int result is int so call the cout. OperatorAnd the secondary pointer, can be matched to the opeartor (void *) output address,

CodePudding user response:

The
references to the tenth floor truth is right or wrong response:
that why is digital, because
Char and int addition, the result is an int,
coutThis sentence is
Cout. Operator<(p);
Cout have multiple overloaded operator, when p is char * nature calls to cout. Operator (char *) output string
When cout<* p + 1, because the char + int result is int so call the cout. OperatorAnd the secondary pointer, can be matched to the opeartor (void *) output address,

Sobering, thank you for your bosses
  • Related