Hi ,programmers!
Please tell me why it's possible to use such condition -

[U]if (!fork ( ))[/U] return 1;

as I know the fork() returns pid_t-type but at the same time "if" needs boolean..

big thanks in advance)

There's no boolean in C. Any incarnation of zero resolves to false; everything else resolves to true. !fork() is therefore synonymous to fork() == 0

commented: +++++ +3

but what about this piece of code -

ret = stat (argv[1], &sb); 

    if (ret) 
        perror ("stat");
        return 1;

as I understand - the "ret" will be =0 after successful perfomance of "stat", but this code won't return an error ...why is it so? explain please/