-7

I tried to convert dec to hex. For example convert 255 to hex.

opa = 255.ToString("X");

gives me error: error: invalid suffix "ToString" on floating constant

I spent lots of time to convert, but couldn't find right way.

user3763437
  • 359
  • 2
  • 10

1 Answers1

3

You're asking about the wrong language. C does not support the dot operator on integers. To do this in C, you need to print it to a string like so.

char numstr[10];
sprintf(numstr, "%X", 255)
Phonon
  • 12,549
  • 13
  • 64
  • 114