C 16
Test1.c Guest on 2nd October 2020 11:15:07 AM
  1. // http://www.cse.lehigh.edu/~brian/course/2013/cunix/notes/debugging.html
  2.  
  3. #include <stdlib.h>
  4. #include <stdio.h>
  5.  
  6. int sum(int x, int y, int z) {
  7.     char c = 4;
  8.     int *a;
  9.  
  10.     return (c + x + y + z + *a) / 3;
  11. }
  12.  
  13. int main(int argc, char *argv[]) {
  14.     int i, j, k;
  15.     int result;
  16.  
  17.     if (argc == 1) {
  18.         printf("Please specify three numbers as parameters.\n");
  19.         exit(1);
  20.     }
  21.  
  22.     i = atoi(argv[1]);
  23.     j = atoi(argv[2]);
  24.     k = atoi(argv[3]);
  25.  
  26.     result = sum(i,j,44) + sum(j,k,55) + sum(i,k,66);
  27.  
  28.     printf("%d\n", result);
  29.  
  30.     return 0;
  31. }

Paste is for source code and general debugging text.

Login or Register to edit, delete and keep track of your pastes and more.

Raw Paste

Login or Register to edit or fork this paste. It's free.