在C语言中,可以使用atoi()函数将字符串转换为int类型。
#include <stdio.h>#include <stdlib.h>int main() { char str[] = "12345"; int num = atoi(str); printf("The converted integer is: %d\n", num); return 0;}在上面的示例中,我们将字符串"12345"转换为整数,并将结果存储在变量num中。然后我们打印出转换后的整数值。


