+ 5
Why int("raja") print some strange number ?
7 Réponses
+ 5
Funny Thing :)
This number seems to be simply a concatenation of the hex values.. (0x72616A61, where 'r' is 0x72, 'a' is 0x61 and 'r' is 0x6A)
I would recommend to use a for loop, to print the ascii values of each individual Charakter...
+ 3
Your code says int('raja'), not int("raja"), but neither of the two were valid candidate for conversion to int anyways. People say garbage in, garbage out, we can't expect a good output when the given input is bad.
Just saying ... ¯\_(ツ)_/¯
+ 3
~ swim ~
What is an example of a valid conversion result from multi character constant to integer? and is there a way to know whether if the conversion result was valid or invalid?
+ 2
~ swim ~
That's alright, I was just asking if there was a way to know if the result was valid. I thought we'd get some error message when conversion fail, but I guess it doesn't have to be (in doubt).