0

I'm trying to make code for converting a base4 number into a base2 number. Here is the code:

#include <iostream>
#include <cstdlib>
#include <iomanip>
#include <bits.h>
#include <algorithm>
using namespace std;

 void itoa(int n, char s[])
 {
     int i, sign;

     if ((sign = n) < 0)
         n = -n;
     i = 0;
     do {
         s[i++] = n % 10 + '0';
     } while ((n /= 10) > 0);
     if (sign < 0)
         s[i++] = '-';
     s[i] = '\0';
     reverse(s);
 }

At the end, there is a reverse function. When I run the code, the error in the title appears. I don't know what to do about this. Thanks in advance!

463035818_is_not_an_ai
  • 109,796
  • 11
  • 89
  • 185

0 Answers0