100% found this document useful (1 vote)
322 views22 pages

Programming in C

This document provides an overview of the C programming language, including: - C was developed in 1972 at AT&T Bell Laboratories and was designed for developing the Unix operating system. It is a simple, general purpose, high-level programming language that enables easy communication with computer hardware. - The C compilation process involves writing C source code, compiling it using a C compiler to generate object code, and linking the object files together with a linker to create an executable program. Integrated development environments provide tools to facilitate the programming process. - The structure of a basic C program includes preprocessor directives, comments, and a main function. Functions like printf() and scanf() are commonly used for input and output

Uploaded by

Yanis Kemoun
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
322 views22 pages

Programming in C

This document provides an overview of the C programming language, including: - C was developed in 1972 at AT&T Bell Laboratories and was designed for developing the Unix operating system. It is a simple, general purpose, high-level programming language that enables easy communication with computer hardware. - The C compilation process involves writing C source code, compiling it using a C compiler to generate object code, and linking the object files together with a linker to create an executable program. Integrated development environments provide tools to facilitate the programming process. - The structure of a basic C program includes preprocessor directives, comments, and a main function. Functions like printf() and scanf() are commonly used for input and output

Uploaded by

Yanis Kemoun
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 22

Programming In C

Part I
Introduction to C
Programming Language
• It is used to convert an algorithm into a
computer program.
• It has a fixed set of words and rules (syntax
and grammer) that are used to write
instructions.
• Three types of programming languages:
– Machine language
– Assembly language
– High level language
C Programming

• It is developed at AT&T Bell laboratories of


USA in 1972, designed and written by Denis
Ritchie.
• At the beginning it was designed for
developing the Unix Operating System, then
proved itself as powerful general purpose
programming language.
• C is a structured programming language and
provides modularity.
Why using C?
• C is simple high level language. It contains only 32
keywords
• C programs run faster than programs written in
most other languages
• C is the basis for many other languages(Java, C++,
C#, and Php...).
• C enables easy communication with computer
hardware
• C is portable. Standard compilers exist for
virtually every processor.
Developing Programs in C
• There are mainly three steps in developing a
program in C:
– Writing the C program
– Compiling the program
– Executing the program
The C Compiler
• The C compiler is a program that converts a C
program (referred to as source code) into
machine language (object code).
• A compiler generates object code files
(machine language) from source code.
• A linker combines these object code files into
an executable.
Programming Environment
• To facilitate the task of computer
programmers, they are provided with a
software application know as Itegrated
Development Envirement (IDE).
• IDE consists of source code Editor, compiler,
and other tools.
• Example of IDEs for C programming: DevC++,
CodeBlocks, Eclipse, …etc.
The Programming Process in IDE
Structure of C Program
• The general structure of a C program is:
First C Program
Preprocessor directive (header file). It is called header because it is written at the beginning
of the program. It tells the compiler to include that file during compilation as a part of the
program.
Preprocessor Directives
Preprocessor Directives (header files)

Examples of some C header files:


Preprocessor Directives (define)
Comments
Main Function
Some functions defined in stdio.h
• Two function defined in the header file stdio.h
and which are used in almost all C programs
are:
– printf()
– scanf()
Printf()
Format specifier
• It tells the printf() function the format of the
output to be printed.
• Examples of format specifiers:
Escape sequence
• It is used in the printf() function to do
something to the output.
• Examples:
Scanf()
Second C Program

You might also like