1 minute read
2.5 FUNDAMENTALS OF C PROGRAM
Character type - used to store characters value. Size and range of character data type on 16-bit machine are as in the table below. Table 2.3: Character Data Type
TYPE SIZE(BYTES) RANGE
Advertisement
char or signed char 1 -128 to 127
unsigned char 1 0 to 255
2.5 FUNDAMENTALS OF C PROGRAM
2.5.1 Structure of C Program
C++ program consists of objects, functions, variables, and other components. There are a few program structures that are very important for to understand why the program must be written in such way.
Figure 2.5: Structure of C Program
2.5.2 Comments
A line starting with /* and ending with */ is a comment. The purpose of a comment is to document and understand the program. It can be used to tell what is the purpose of using variables or functions. It also enables your program to be easily understood by others. Comment will not be executed by the compiler.
2.5.3 Main function and functions
In programming, function refers to a segment that groups code to perform a specific task. Depending on whether a function is predefined or created by programmer; there are two types of function: a) Library Function b) User-defined Function
a) Library Function
C Standard library functions or simply C Library functions are inbuilt functions in C programming. The prototype and data definitions of these functions are present in their respective header files. To use these functions, we need to include the header file in our program. For example,
Figure 2.6: Function in C Program