Archive

Archive for the ‘C Tutorials’ Category

C Tutorial – Operators in C

May 25th, 2008 17 comments

An operator is a symbol that operates on a certain data type and produces the output as the result of the operation. In C, you can combine various operators of similar or different categories and perform an operation. In this case the C compiler tries to solve the expression as per the rules of precedence.

Read more…

C Tutorial – Constants, Variables and Data Type Modifiers

May 25th, 2008 3 comments

Constant

A constant can be defined as “a quantity that does not change during the execution of a program”.

#include <stdio .h>
 
void main(void)
{
        int a = 10;
        printf(“%d”,a);
}
</stdio>

Program Output
10

Here we are declaring a variable a with its initial value 10. 10 here is an integer constant and every time you try to execute this program, the output will always be 10.

Read more…

C Tutorial – Fundamental Data Types

May 22nd, 2008 1 comment

In this C Tutorial we will learn what Fundamental Data Types are and how to use them.

We develop programs to accept an input from the user and then run the input through a series of processes and produce the output on screen or on the printer, etc.

Read more…

Introduction to C Programming

May 18th, 2008 2 comments

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.

It is hoped that newcomers will find C a useful and friendly language. Care must be taken in using C. Many of the extra facilities which it offers can lead to extra types of programming error. You will have to learn to deal with these to successfully make the transition to being a C programmer.

The course aims to introduce programmers to the C language. Previous programming experience is assumed, so we can quickly progress to looking at the features of C and their uses. Students with little programming experience will need to do some homework in order to keep up with the lectures.

Read more…