fork download
  1. #include <stdio.h>
  2.  
  3. int sum(int a, int b); //함수원형
  4. void swap(int *p, int *q);
  5.  
  6. int main(void)
  7. {
  8. int a, b, total;
  9. printf("input two integers: ");
  10. scanf("%d%d", &a, &b);
  11. printf("a:%d, b:%d \n", a, b);
  12. total = sum(a, b);
  13. printf("**sum function call**\n");
  14. printf("%d+%d=%d\n", a, b, total);
  15. swap(&a,&b);
  16. printf("**swap function call**\n");
  17. printf("a:%d, b:%d \n", a, b);
  18. return 0;
  19. }
  20.  
  21. int sum(int a, int b)
  22. {
  23. int total;
  24. total = a + b;
  25. return total;
  26. }
  27.  
  28. void swap(int *p, int *q)
  29. {
  30. int temp;
  31. temp = *p;
  32. *p = *q;
  33. *q = temp;
  34. }
Success #stdin #stdout 0s 4520KB
stdin
Standard input is empty
stdout
input two integers: a:1296271120, b:32766 
**sum function call**
1296271120+32766=1296303886
**swap function call**
a:32766, b:1296271120