C and C++ Programming Resources | C & C++ Code Example Index | C++ Code Example Index



The C Functions and Formatted I/O Sample Codes Index Page


The following links provides C program example for C functions and formatted input/output. The C functions demonstrate how to construct the functions with several variations. Function is one of the important construct in C to do the common tasks or routines. It is reusable, self contained and independent routines. The C formatted input/output used for reading from and writing to the computer standard and non-standard input/output.


C User Defined Functions (The C user defined functions code and program examples)



  1. The C functions: function calls and returns showing the execution flow C program example

  2. Various C function constructs, passing to and returning a value from functions

  3. How to use time and date related C functions to determine the day of the week for the given date in C program example

  4. A very simple C program on how to generate random number using rand() built-in function

  5. Another random number generator C code example using rand() function

  6. How to create and use the C variadic functions which receive and return variable number of arguments

  7. How to return a value from multiple values processed by C function

  8. Passing an argument to a function by value, process the argument and return a value to the calling function

  9. A very simple C user defined function demonstrating how to calculate cube volume for the given side

C Formatted Input/Output (The C formatted Input/Output code samples)

  1. The C formatted input/output: Reading from standard input and writing to standard output while discarding characters from the input stream

  2. Reading the input data with a several field widths using scanf()/scanf_s() C function

  3. Reading from standard input and writing characters and strings to standard output using scanf()/scanf_s() and printf() C functions

  4. Reading using scanf()/scanf_s() and writing using printf() C function for floating-point numbers

  5. Reading integers from standard input and writing to standard output, in various formatted output

  6. Printing integers with the 0 (zero) flag fills in leading zeros in C programming

  7. The o, x, X, #, g and G conversion specifiers for floating-point used in printf() C function

  8. Printing a space before the signed integer values in C programming using printf() C function

  9. Printing with right and left justified using printf() function in C programming

  10. Using precision while printing integers, floating-point numbers and strings using printf() C function

  11. Printing integers right-justified using printf() C function

  12. The p, n, and % conversion specifiers printf() C function program example

  13. Printing strings and characters using printf() C function

  14. Printing floating-point numbers with various conversion specifiers of the printf() C function

  15. Displaying integers in various formatted output using conversion specifiers of the printf() C function


C and C++ Programming Resources | C & C++ Code Example Index | C++ Code Example Index