GE6151 Computer Programming C PROGRAMMING BASICS

C PROGRAMMING BASICS

Problem formulation – Problem Solving - Introduction to ‘ C’ programming –fundamentals – structureof a ‘C’ program – compilation and linking processes – Constants, Variables – Data Types –Expressions using operators in ‘C’ – Managing Input and Output operations – Decision Making and Branching – Looping statements – solving simple scientific and statistical problems.

INTRODUCTION TO C

As a programming language, C is rather like Pascal or Fortran.. Values are stored in variables. Programs are structured by defining and calling functions. Program flow is controlled using loops, if statements and function calls. Input and output can be directed to the terminal or to files. Related data can be stored together in arrays or structures.

Of the three languages, C allows the most precise control of input and output. C is also rather more terse than Fortran or Pascal. This can result in short efficient programs, where the programmer has made wise use of C's range of powerful operators. It also allows the programmer to produce programs which are impossible to understand. Programmers who are familiar with the use of pointers (or indirect addressing, to use the correct term) will welcome the ease of use compared with some other languages. Undisciplined use of pointers can lead to errors which are very hard to trace. This course only deals with the simplest applications of pointers.

A Simple Program

The following program is written in the C programming language.

#include <stdio.h>

main()

{

printf("Programming in C is easy.\n");

}