Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Class notes

C Programming Notes

Rating
-
Sold
-
Pages
142
Uploaded on
05-04-2023
Written in
2022/2023

It would provide you all basic to advance c programming content to help you to understand and learn c programming language.

Institution
Course

Content preview

Computer Programming – I C-Programming



Chapter-1
Introduction to C Programming



Objectives

This section is designed to give you a general overview of the C programming
language. Although much of this section will be expanded in later sections it gives
you a taste of what is to come.




Why use C?

C has been used successfully for every type of programming problem imaginable
from operating systems to spreadsheets to expert systems - and efficient compilers
are available for machines ranging in power from the Apple Macintosh to the Cray
supercomputers. The largest measure of C's success seems to be based on purely
practical considerations:

• The portability of the compiler
• The standard library concepts.
• A powerful and varied repertoire of operators
• An elegant syntax
• Ready access to the hardware when needed
• The ease with which applications can be optimised by hand-coding isolated
procedures

C is often called a "Middle Level" programming language. This is not a reflection
on its lack of programming power but more a reflection on its capability to access
the system's low-level functions. Most high-level languages (e.g., Fortran) provides
everything the programmer might want to do already built into the language. A low-
level language (e.g., assembler) provides nothing other than access to the
machines basic instruction set. A middle level language, such as C, probably
doesn't supply all the constructs found in high-languages - but it provides you with
all the building blocks that you will need to produce the results you want!

Uses of C
Dr.Sachin Bojewar (M) 9323232781
M.Tech (Comp, PhD

,Computer Programming – I C-Programming


C was initially used for system development work, in particular the programs that
make-up the operating system. Why use C? Mainly because it produces code that
runs nearly as fast as code written in assembly language. Some examples of the
use of C might be:

• Operating Systems
• Language Compilers
• Assemblers
• Text Editors
• Print Spoolers
• Network Drivers
• Modern Programs
• Data Bases
• Language Interpreters
• Utilities

In recent years C has been used as a general-purpose language because of its
popularity with programmers. It is not the world's easiest language to learn and
you will certainly benefit if you are not learning C as your first programming
language! C is trendy, many well established programmers are switching to C for
all sorts of reasons, but mainly because of the portability that writing standard C
programs can offer.

A Brief History of C

C is a general-purpose language which has been closely associated with the Unix
operating system for which it was developed - since the system and most of the
programs that run it are written in C.

Many of the important ideas of C stem from the language BCPL, developed by
Martin Richards. The influence of BCPL on C proceeded indirectly through the
language B, which was written by Ken Thompson in 1970 at Bell Labs, for the first
UNIX system on a DEC PDP-7. BCPL and B are "type less" languages whereas
C provides a variety of data types.

In 1972 Dennis Ritchie at Bell Labs writes C and in 1978 the publication of The C
Programming Language by Kernighan & Ritchie caused a revolution in the
computing world.



Dr.Sachin Bojewar (M) 9323232781
M.Tech (Comp, PhD

,Computer Programming – I C-Programming


In 1983, the American National Standards Institute (ANSI) established a committee
to provide a modern, comprehensive definition of C. The resulting definition, the
ANSI standard, or "ANSI C", was completed late 1988.

C for Personal Computers

With regards to personal computers Microsoft C for IBM (or clones) PC's. and
Borlands C are seen to be the two most commonly used systems. However, the
latest version of Microsoft C is now considered to be the most powerful and efficient
C compiler for personal computers.

Running c Program

This section is primarily aimed at the beginner who as no or little experience of
using compiled languages. I cover the various stages of program development.
The basic principles of this section will apply to what ever C compiler you choose
to use, the stages are nearly always the same

The Edit-Compile-Link-Execute Process

Developing a program in a compiled language such as C requires at least four
steps:

1. editing (or writing) the program
2. compiling it
3. linking it
4. executing it

Editing

You write a computer program with words and symbols that are understandable to
human beings. This is the editing part of the development cycle. You type the
program directly into a window on the screen and save the resulting text as a
separate file. This is often referred to as the source file (you can read it with the
TYPE command in DOS or the cat command in unix). The custom is that the text of
a C program is stored in a file with the extension .c for C programming language

Compiling

You cannot directly execute the source file. To run on any computer system, the
source file must be translated into binary numbers understandable to the
computer's Central Processing Unit (for example, the 8088 microprocessor). This
process produces an intermediate object file - with the extension .obj, the .obj
stands for Object.
Dr.Sachin Bojewar (M) 9323232781
M.Tech (Comp, PhD

, Computer Programming – I C-Programming


Linking

The first question that comes to most people’s minds is Why is linking necessary?
The main reason is that many compiled languages come with library routines which
can be added to your program. Theses routines are written by the manufacturer of
the compiler to perform a variety of tasks, from input/output to complicated
mathematical functions. In the case of C the standard input and output functions
are contained in a library (stdio.h) so even the most basic program will require a
library function. After linking the file extension is .exe which are executable files.

Executable files

Thus, the text editor produces .c source files, which go to the compiler, which
produces .obj object files, which go to the linker, which produces .exe executable
file. You can then run .exe files as you can other applications, simply by typing
their names at the DOS prompt or run using windows menu.

Using Microsoft C

Edit stage:

Type program in using one of the Microsoft Windows editing packages.

Compile and link:

Select Building from Make menu. Building option allows you to both
compile and link in the same option.

Execute:

Use the Run menu and select Go option.
Errors:

First error highlighted. Use Next Error from Search menu for further
errors if applicable.

If you get an error message, or you find that the program doesn't work when you
finally run it (at least not in the way you anticipated) you will have to go back to the
source file - the .c file - to make changes and go through the whole development
process again!




Dr.Sachin Bojewar (M) 9323232781
M.Tech (Comp, PhD

Written for

Course

Document information

Uploaded on
April 5, 2023
Number of pages
142
Written in
2022/2023
Type
Class notes
Professor(s)
Sachin
Contains
All classes

Subjects

$6.49
Get access to the full document:

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Get to know the seller
Seller avatar
sahilnaik

Get to know the seller

Seller avatar
sahilnaik VIT
Follow You need to be logged in order to follow users or courses
Sold
-
Member since
3 year
Number of followers
0
Documents
1
Last sold
-

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions