fork download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4. char* a = "1234567";
  5. unsigned short res[2] = {0};
  6. int charidx = strlen(a);
  7. int ind = 0;
  8. unsigned short mul = 1;
  9.  
  10. while(charidx) {
  11. res[ind] += mul * (a[--charidx] - '0');
  12. if (mul < 1000) {
  13. mul *= 10;
  14. }
  15. else {
  16. mul = 1;
  17. ind++;
  18. }
  19. }
  20. printf("%d %d", res[0], res[1]);
  21. return 0;
  22. }
  23.  
Success #stdin #stdout 0s 4288KB
stdin
Standard input is empty
stdout
4567 123