The scanf() function is used to take input from the user in C programming. It can be used to read characters, strings, and numeric values. The basic format of scanf() requires a format string that specifies the type of data to read and a variable list containing the variables to store the input, with each variable preceded by an ampersand. Scanf() can read different data types like integers, floats, and characters by using format specifiers like %d, %f, and %c respectively. Multiple variables can also be given as input by separating them with commas in the variable list.