【发布时间】:2021-05-27 20:19:16
【问题描述】:
我想将字符串 "12341234123412341234" 转换为 int,但是当我使用 atoi 时它返回 -1
char n[100] = "12341234123412341234";
printf("%d",atoi(n));
返回-1
如果我使用%ld 或%lld 它会返回一个垃圾值
char n[100] = "12341234123412341234";
printf("%lld",atoi(n)); //even if i use %ld it returns the same value
返回4294967295
【问题讨论】: