Hi, I was trying to make a program but, when add sprintf
to the equation, I get the following error:
Program received signal: "SIGABRT"
My sprintf
is written as follows:
int i;
int g;
char b[6];
sprintf(b, "%d", i*g);
If you need to see the whole code here it is (but you probably don't, just in case though):
#include <stdio.h>
#include <stdlib.h>
int main (int argc, const char * argv[]) {
int i;
int g;
char b[6];
char temp[6];
char c[6];
int lol;
int revlol;
int assign;
for (i = 100; i < 1000; i++)
{
sprintf(b, "%d", i*g);
for (g = 100; g < 1000; g++)
{
for (lol = 5; lol > -1; lol--)
{
for (revlol = 0; revlol < 6; revlol++)
{
temp[lol] = b[revlol];
}
if (temp == b)
{
for (assign = 0; assign < 6; assign++)
{
c[assign] = b[assign];
}
}
}
}
}
printf("%s", c);
}
But, the problem only happens when I use sprintf
. Also note: I am not using itoa
because my compiler does not allow it.
Any help would be appreciated!