If Statement in C

C Programming Tutorial

Like most languages, C uses the keyword if to implement the decision control instruction. The general form of if statement looks like this: if ( this condition is true )       execute this statement ; The keyword if tells the compiler that what follows is a decision control instruction. The condition following the … Read more

Control Instructions in C

C Programming Tutorial

As the name suggests the ‘Control Instructions’ enable us to specify the order in which the various instructions in a program are to be executed by the computer. In other words the control instructions determine the ‘flow of control’ in a program. There are four types of control instructions in C. They are: Sequence Control … Read more

Hierarchy of Operations in C

C Programming Tutorial

While executing an arithmetic statement, which has two or more operators, we may have some problems as to how exactly does it get executed. For example, does the expression 2 * x – 3 * y correspond to (2x)-(3y) or to 2(x-3y)? Similarly, does A / B * C correspond to A / (B * … Read more

Integer and Float Conversions in C

C Programming Tutorial

In order to effectively develop C programs, it will be necessary to understand the rules that are used for the implicit conversion of floating point and integer values in C. These are mentioned below. Note them carefully. An arithmetic operation between an integer and integer always yields an integer result. An operation between a real … Read more

C Instructions

C Programming Tutorial

We have seen the first c program, Now let us look at the instructions that we used in these programs. There are basically three types of instructions in C: Type Declaration Instruction – To declare the type of variables used in a C program. Arithmetic Instruction – To perform arithmetic operations between constants and variables Control Instruction … Read more

Scanf() : Receiving input in C program

C Programming Tutorial

In the First C Program discussed earlier (same has been also mentioned below for the reference) we assumed the values of p, n and r to be 1000, 3 and 8.5. Every time we run the program we would get the same value for simple interest. If we want to calculate simple interest for some other … Read more

Compilation and Execution of C Program

C Programming Tutorial

Once you have written the program you need to type it and instruct the machine to execute it. To type your C program you need another program called Editor. Once the program has been typed it needs to be converted to machine language (0’s and 1’s) before the machine can execute it. To carry out … Read more