APLawrence.com -  Resources for Unix and Linux Systems, Bloggers and the self-employed

null


© October 2003 Tony Lawrence
2003/10/27

Nothing. Not zero (though zero may be used to represent it), but nothingness. The /dev/null device is a throw-away bit bucket used when you don't want to see the output: often a cron entry would be something like "/usr/bin/someprog > /dev/null 2>&1"

C language strings are null (zero) terminated, and functions may return NULL pointers if they were supposed to return a pointer to something real. Don't confuse this with the very common convention in the shell and elsewhere of returning 0 for success.

The fact that null is often the same as zero is a source of problems. For example, is a reference to "0" a reference to null or a legitimate attempt to access the very first byte of memory? See section 1.3 and 1.4 of https://www.lysator.liu.se/c/c-faq/c-1.html. A Google search for "NULL Pointer" will lead to all sorts of problems, confusion and errors.


Got something to add? Send me email.





(OLDER)    <- More Stuff -> (NEWER)    (NEWEST)   

Printer Friendly Version

->
-> null


Inexpensive and informative Apple related e-books:

Sierra: A Take Control Crash Course

iOS 10: A Take Control Crash Course

El Capitan: A Take Control Crash Course

iOS 8: A Take Control Crash Course

Take Control of Pages




More Articles by © Tony Lawrence


"The /dev/null device is a throw-away bit bucket used when you don't want to see the output..."

/dev/null can also be used as a source of input when you want to test EOF logic in a program. A read from /dev/null will always return EOF. Beats waiting until you get to the other end of a big file.

--BigDumbDinosaur




Printer Friendly Version

Have you tried Searching this site?

This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more.

Contact us


Printer Friendly Version





In C++ it's harder to shoot yourself in the foot, but when you do, you blow off your whole leg. (Bjarne Stroustrup)




Linux posts

Troubleshooting posts


This post tagged:

Programming

Shell

UnixWords



Unix/Linux Consultants

Skills Tests

Unix/Linux Book Reviews

My Unix/Linux Troubleshooting Book

This site runs on Linode