fork download
  1. #include <stdio.h>
  2. #include <limits.h>
  3.  
  4. #if MAX_INT <= 2147483647
  5. # define SIZE 10 //if sizeof(int)==4 , max int : 2147483647
  6. #else
  7. # define SIZE 19 //if sizeof(int)==8 , max int : 9223372036854775807
  8. #endif
  9.  
  10. int main(void){
  11. int longNum = 12345, tempNum[SIZE];
  12. int i, j;
  13.  
  14. for(i = SIZE; longNum > 0;){
  15. tempNum[--i] = longNum % 10;
  16. longNum /= 10;
  17. }
  18. for(j = i; j < SIZE; ++j)
  19. printf("%d\n", tempNum[j]);
  20. return 0;
  21. }
  22.  
Success #stdin #stdout 0s 2112KB
stdin
Standard input is empty
stdout
1
2
3
4
5