Sunday, 17 June 2012

Sir Asdullah Bhatti The 6th lecture



LECTURE#06
INTRODUCTION TO C LANGUAGE

SUMMARY
·         Introduction to c language
·         IDE – Integrated development environment
·         Write first program in C Language
·         Compiling & Linking process
·         Errors and their types

INTRODUCTION TO C LANGUAGE
What should I say C language is a high level programming language, developed by Denis Ritchie @ bell laboratories, actually I am not concern about the history but as a student you must know so it is your assignment to search the history of C language

IDE – INTEGRATED DEVELOPMENT ENVIORNMENT
An integrated development environment is a software application that provide comprehensive facilities to computer programmers for software development and IDE can consist of
1.       Source code editor
2.       Debugger
3.       Language translator
There are lots of IDEs are available in the market for C language development, for example Dev C++, Turbo C++ 4.5 etc you can download any of this from internet

Write first program in C Language

#include<conio.h>                                                                          Header files (pre-processors)
#include<stdio.h>

Void main ()                                                                                       main function – entry point of program
{                                                                                                              start main function
                clrscr();                                                                                 clear screen function  - previous screen

cout<<”Hello, World”;                                                                   for sending stream to console screen

}                                                                                                              end main function










COMPILING & LINKING PROCESS
The program you types in editor is source file, it has a CPP file extension. Remember that source file is not an executable program, it is just the instruction written in high level language and these instructions are not understandable by micro processor. Transferring your source program file into executable program requires two steps.

First you should compile the source file into object file, object file contains a machine language instructions that is executable by micro processor. However these instructions are not complete. Second step in called linking is required because might be your program required library routines.

This picture depict the compilation and linking process




  




















ERRORS
As a computer programmer I believe that no one can write error-free computer program, followings are some type of errors

1.      Compiler errors
These are the errors generated during compile time due to mistyping or forgotten something for example you forget the semi colon after the “cout”, when you compile the source code compiler will show you the error.

2.      Linker Errors
You can experience errors also in linking process, for example you have used the math library in your program but forget to declare the library file <math.h>

3.      Run time errors
You experienced some errors after executing program like divide by zero

4.      Logical errors
I love to see this type of errors, compiler or linker will not inform you about these types of errors because you program was syntactically correct and you have provide all the preprocessor of library files you used.

Read this sentence, I am sure you will understand what the logical error means

“I am a human and I am flying with my wings”

What do you think?  Sentence is grammatically 100% correct but logically completely wrong

So this is the most critical errors to debug

In simple words we can say “errors in output”, or “errors in you logic transformation”;



No comments:

Post a Comment