#include <stdio.h>
#include <stdlib.h>
#define TRUE  1
#define FALSE 0
void recursion (int a) {
    if (a != 0) {
        recursion(--a); //works
        recursion(a--); //does not work
        printf("%d\n", a);
    } 
}
int main (int argc, char *argv[]) {
    printf("start\n");
    recursion(10);
    printf("finished\n");
    return 0;
}
Why is there a segmentation fault when I recurse (a--) but works fine when I recurse (--a)?
I don't think recursion(a--) is wrong due to undefined behavior because there is only one side effect, which is to decrease a by 1. This side effect is exactly what I wanted. Thanks.
 
    