/* * compute n! * * this program has a bug -- comments omitted to hide it * used to demonstrate static and dynamic debugging * * Matt Bishop, ECS 36A, Fall 2019 */ #include int nfact(int n) { int x; x = nfact(n-1); return(n * x); } int main(int argc, char *argv[]) { int n; if (argc != 2 || sscanf(argv[1], "%d", &n) != 1){ fprintf(stderr, "Usage: %s [ number ]\n", argv[0]); return(1); } printf("%d! = %d\n", n, nfact(n)); return(0); }