Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- char* itoa(int x, char* str)
- {
- int rem;
- int i=0, j=0;
- if (x < 0) {
- str[i++] = '-';
- x = -x;
- j++;
- }
- do {
- rem = x % 10;
- x /= 10;
- str[i++] = (char)(rem + '0');
- } while (x > 0);
- str[i--] = 0;
- while (j < i) {
- str[j] ^= str[i];
- str[i] ^= str[j];
- str[j] ^= str[i];
- j++; i--;
- }
- return str;
- }
Add Comment
Please, Sign In to add comment