0

I want to convert an int to char *

char str[10]=;
int i=567;

str=itoa(i, str, 10)

This gives an error on str the third line

str must have a modifiable lvalue

Rob Kielty
  • 7,740
  • 7
  • 37
  • 50
user1391118
  • 265
  • 2
  • 4
  • 12
  • 1
    possible duplicate of [How to convert a number to string and vice versa in C++](http://stackoverflow.com/questions/5290089/how-to-convert-a-number-to-string-and-vice-versa-in-c) – Mat May 27 '12 at 17:09
  • @Mat i am using char * not string... – user1391118 May 27 '12 at 17:10
  • 6
    And still, you better convert it to an std::string and then use the. .c_str() method... – Eitan T May 27 '12 at 17:16

1 Answers1

12
char str[10]; 
int i=567; 
itoa(i, str, 10);
Jake
  • 10,929
  • 20
  • 84
  • 141