Issue
#include <stdio.h>
int main()
{
char*str="↔⬆🙂12345";
printf("%d",*str );
return 0;
}
please help me to find the output of the given code
Solution
Assuming the file is encoded using UTF-8, the string consists of these bytes in hex:
E2 86 94 E2 AC 86 F0 9F 99 82 31 32 33 34 35
On a system where char
means unsigned char
, the first char is 226.
On a two's-complement system where char
means signed char
, the first char is -30.
On a one's-complement system where char
means signed char
, the first char is -29.
This value will be promoted to an equivalent int
, passed to printf
, and printed.
Answered By - ikegami Answer Checked By - Pedro (PHPFixing Volunteer)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.