This document discusses key concepts in C programming including hierarchy of operations, associativity of operators, the history of C, and compiling and running a C program. It explains that hierarchy of operations determines the order calculations are performed based on operator precedence. Associativity refers to how operators of the same priority are handled from left to right or right to left. The history section gives a brief overview of the origins and development of the C language. Finally, it outlines the basic steps to compile a C program into an executable file.
This document discusses key concepts in C programming including hierarchy of operations, associativity of operators, the history of C, and compiling and running a C program. It explains that hierarchy of operations determines the order calculations are performed based on operator precedence. Associativity refers to how operators of the same priority are handled from left to right or right to left. The history section gives a brief overview of the origins and development of the C language. Finally, it outlines the basic steps to compile a C program into an executable file.
This document discusses key concepts in C programming including hierarchy of operations, associativity of operators, the history of C, and compiling and running a C program. It explains that hierarchy of operations determines the order calculations are performed based on operator precedence. Associativity refers to how operators of the same priority are handled from left to right or right to left. The history section gives a brief overview of the origins and development of the C language. Finally, it outlines the basic steps to compile a C program into an executable file.
Hierarchy of operations The priority or precedence in which the operations in an arithmetic statement are performed is called the hierarchy of operations.
Note that 6 / 4 gives 1 and not 1.5
because 6 and 4 both are integers and therefore 6 / 4 must evaluate to an integer. Similarly 5 / 8 evaluates to zero, since 5 and 8 are integers and hence 5 / 8 must return an integer value.
By Er. Rupesh Kumar Nidhi 2
Associativity of Operators Ø When an expression contains two operators of equal priority the tie between them is settled using the associativity of the operators. Ø All operators in C have either Left to Right associativity or Right to Left associativity. Ø Let us understand this with the help of a few examples. vConsider the expression a = 3 / 2 * 5 ; Here there is a tie between operators of same priority, that is between / and *. This tie is settled using the associativity of / and *. Both enjoy Left to Right associativity. Therefore firstly / operation is done followed by *. vConsider a = b = 3 ; Here both assignment operators have the same priority. So order of operations is decided using associativity of = operator. = associates from Right to Left. Therefore, second = is performed earlier than first =.
By Er. Rupesh Kumar Nidhi 3
Associativity of Operators…
By Er. Rupesh Kumar Nidhi 4
History of C
By Er. Rupesh Kumar Nidhi 5
Overview of C program
By Er. Rupesh Kumar Nidhi 6
Compiling and Running a program Ø Compiler translates source program into another representation or file with extension .o called object file.(e.g. sample.o)
Ø Linking is the process of putting
together other program files and functions that are required by the program
Ø And finally the compiled and linked
program is called executable object code and stored as extension of .out (e.g. sample.out)