C Programming
BTM 3234 Manufacturing Computer
Application
Dr Mohd Azraai Bin Mohd Razman
&
M. Jothi Letchumy
BTM 3234 1
C Programming terms
Terms Definition
<stdio.h> • Standard input/output function
• Contains declaration of printf() and
scanf()
<stdlib.h> • Standard Library
• It has the information of memory
allocation/freeing functions
printf() • It is used to print the strings, integer,
character etc on the output screen
scanf() • It reads the character, string, integer
etc from the keyboard
getc() • It reads the character from the file
putc() • It writes the character to the file
BTM 3234 2
fopen() • It opens the file, and all file
handling functions are defined in
stdio.h header file
fclose() • It closes the opened file
remove() • It deletes the file
fflush() • It flushes the file
BTM 3234 3
BTM 3234 4
The very first line is preprocessor command, which tells a C compiler to
#include <stdio.h> file before going to actual compilation.
The next line int main() is the main function where the program execution
begins
The next line printf(…) is another function available in C which causes the
message “Hello World!” to be displayed on the screen.
The next line return 0; terminates the main() function and returns the value
0.
BTM 3234 5
stdlib.h • Standard Library
• Contains header information for
‘Memory Allocation/Freeing’
functions
malloc() • This function is used to allocate
space in memory during the
execution of the program
calloc() • This function is also like malloc()
function. But calloc() initializes the
allocated
realloc() • This function modifies the allocated
memory size by malloc() and calloc()
functions to new size
free() • This function frees the allocated
memory by malloc(), calloc(),
realloc() functions and returns the
memory to the system.
BTM 3234 6
Escape Sequences Definition
\b • Backspace
\f • Form Feed
\n • Newline
\r • Return
\t • Horizontal tab
\v • Vertical tab
\\ • Backslash
\’ • Single quotation mark
\” • Double quotation mark
\? • Question mark
\0 • Null Character
BTM 3234 7