converting char array into one int
- by user1762517
I can't use atoi, need to do it digit by digit.. How do I save it in a int.. given a char* temp put it all in one int..
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
int main () {
char* temp = "798654564654564654";
int i = 0;
for (i = 0; i < strlen(temp); i++) {
printf("%d", temp[i] - 48);
}
printf("\n");
}