如何将char a [0]转换为int b [0],其中b是一个空的动态分配的int数组
我试过了
char a[] = "4x^0";
int *b;
b = new int[10];
char temp = a[0];
int temp2 = temp - 0;
b[0] = temp2;
Run Code Online (Sandbox Code Playgroud)
我想4但它给了我ascii值52
也在做
a[0] = atoi(temp);
Run Code Online (Sandbox Code Playgroud)
给我错误:从'char'无效转换为'const char*'初始化'int atoi(const char*)'的参数1