Trying to convert a character array to int data type in c++11. Why is the int value i
different than the character array value
?
// Example program
#include <iostream>
#include <string>
int main()
{
char value[] = "51093843802";
printf("%s\n", value);
int i = std::atoi(value);
printf("%d\n", i);
}
51093843802
-445763750
Aucun commentaire:
Enregistrer un commentaire