Pejman Moghadam / C-programming

C - Maximum exit code

Public domain


/* Because of atoi(), at least stdlib.h
 * should be included. But this program
 * compiles without any #include.
 * I don't know why.
 */
main(int argc,char *argv[])
{
        return atoi(argv[1]); 
}

Output

It seems 255 is the maximum exit code.

$ ./a.out 12

$ echo $?
12

$ ./a.out 255

$ echo $?
255

$ ./a.out 256

$ echo $?
0

$ ./a.out 257

$ echo $?
1

BY: Pejman Moghadam
TAG: c, exit-code
DATE: 2011-06-01 15:09:06


Pejman Moghadam / C-programming [ TXT ]