use of (void) type in C

utzoo!watmath!rday utzoo!watmath!rday
Mon Jan 3 11:03:24 AEST 1983


  A common use of the void type is to use it as a cast for functions
which normally return values, but you wish to ignore:

      strcpy(str1,str2)  will cause lint to respond that strcpy always
                         returns which is ignored, but

 (void) strcpy(str1,str2)  keeps lint happy.

  In either case, normal cc compiling will work correctly.



More information about the Comp.lang.c mailing list