Name: Anonymous 2013-10-20 22:56
Post a random function that you made. May be from any project you've done or make one impromptu.
Any QUALITY is allowed. No bullying!
Any QUALITY is allowed. No bullying!
better use while((c = fgetc (f)) != EOF || (!feof (f) && !ferror (f))No. K&R2 goes through the entire fucking book using the style used in >>152. Your scenario is ridiculous
you don't return something from that function, you should retrun void and in C11 you can add _Noreturn with the voidI need to return something or it would not have compiled since I used
error
in an expression and the value was not ignored.what if *++argv == NULL?Then fopen would have failed and error would have caught it.
In my opinion using a error function that destroys the progam is bad for two reasons:Your opinion isn't bad practice. exit exists to be able to terminate the process from any function. Your code may have to look much worse if you insist on exiting through main.
you don't check the return value of fprintf, vfprintf, putcharI don't need to check the return value. If it failed writing the output than nothing can be done. What am I going to do if it fails writing the error? Try writing another error?
you don't use GNU StyleGNU Style is shit.