How to Solve Int Data overflow error

int type maximum ten digits 2147483647
int m=1;
int n=1345;
for(m=1;m<=1000000000;m*=10)
{ int d=n/m%10; printf(“%d\n “,d); } will report an error overflow, because the maximum m is, and then execute 1000000000*10 to overflow

 

Improve

int m=1;
int n=1345;
for(m=1000000000;m>
=1;m/=10)
{ int d=n/m%10; printf(“%d\n”,d); } this Hour output from high output 1 3 4 5


Read More: