The result in this situation is based on whats on top of the stack when test() is returned. The behaviour is undefined.
You should compile your code with warnings enabled:
gcc main.c -Wall
Also, altering your argv pointer is a bit dirty. De-referencing argv directly communicates your intentions in a clear way:
printf("\n%d\n", test(atoi(*++argv), 2));
printf("\n%d\n", test(2, atoi(*argv)));
Should be:
printf("\n%d\n", test( atoi(argv[1]), 2) );
printf("\n%d\n", test( 2, atoi(argv[1]) ) );
3
solved Unclear about return value of a void function in C [closed]