The difference is the value that it returns.
fwrite
returns the number of data elements written.
If you execute
count = fwrite(ptr, 1, N, stdout);
then count
will contain the exact number of bytes successfully written. If you do:
count = fwrite(ptr, N, 1, stdout);
then count
will contain 1
if the entire write succeeded, or 0
if any of it failed.
The distinction may be useful if you need to distinguish between partial success and complete failure. If a partial write is no better than not writing anything at all, you can use the second form.
(There's not likely to be any significant difference in performance.)
See also this similar question about fread
.