0% found this document useful (0 votes)
48 views18 pages

Chapter One

Here is a brief summary of the history of C programming language: - C was developed in the early 1970s by Dennis Ritchie at Bell Labs. It was created as a system programming language for writing operating systems like UNIX. - The development of C was closely tied to the development of the UNIX operating system. Many of the operating system functions were implemented as C library functions making it easy to write UNIX tools and applications in C. - C soon became a popular language for system programming due to its efficiency and ability to handle low-level tasks. It allowed programmers to write programs that were very close to the machine level. - By the late 1970s and 1980s, C had become widely popular for application
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
48 views18 pages

Chapter One

Here is a brief summary of the history of C programming language: - C was developed in the early 1970s by Dennis Ritchie at Bell Labs. It was created as a system programming language for writing operating systems like UNIX. - The development of C was closely tied to the development of the UNIX operating system. Many of the operating system functions were implemented as C library functions making it easy to write UNIX tools and applications in C. - C soon became a popular language for system programming due to its efficiency and ability to handle low-level tasks. It allowed programmers to write programs that were very close to the machine level. - By the late 1970s and 1980s, C had become widely popular for application
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 18

Introduction to C Language

Chapter One

Instructor: Mrs. Maryam


Farah
History of C Language
C is a general-purpose, high-level language that was
originally developed by Dennis M. Ritchie to develop the
UNIX operating system at Bell Labs.
The UNIX operating system, the C compiler, and essentially
all UNIX applications programs have been written in C. The
C has now become a widely used professional language for
various reasons.
Easy to learn
Structured language
It produces efficient programs.
It can handle low-level activities.
It can be compiled on a variety of computer platforms.
What is C?
 A programming language is a set of words, codes, and symbols
that allow a programmer to give instructions to the computer.
Many programming languages exist, each with their own
rules, or syntax, for writing these instructions.
Why to use C?
C was initially used for system development work, in
particular the programs that make-up the operating
system. Some examples of the use of C might be:
 Operating Systems
 Language Compilers
 Assemblers
 Text Editors
Why do we call C Programming
language as C ?
 "It was named "C" because many of its features were derived from
an earlier language called "B“.
 C is a successor of B language, which was introduced around 1970.
 C came after B which was based on BCPL, which stands for "Basic
Combined Programming Language." There was never an A.
C Environment Setup
If you are still willing to set up your environment for C
programming language, you need the following two
software available on your computer, (a) Text Editor
and (b) The C Compiler.
Text Editor
The files you create with your editor are called source files
and contain program source code. The source files for C
programs are typically named with the extension ".c".
Before starting your programming, make sure you have
one text editor in place and you have enough experience to
write a computer program, save it in a file, compile it and
finally execute it.
The C Compiler
The source code written in source file is the human
readable source for your program. It needs to be
"compiled", to turn into machine language so that your
CPU can actually execute the program as per
instructions given.
This C programming language compiler will be used
to compile your source code into final executable
program.
C - Program Structure
Before we study basic building blocks of the C
programming language, let us look a bare minimum C
program structure so that we can take it as a reference in
upcoming chapters.
C Hello World Example
A C program basically consists of the following parts:
 Preprocessor Commands
 Functions
 Variables
 Statements & Expressions
 Comments
C - Program Structure
Let us look at a simple code that would print the words
"Hello World":
#include <stdio.h>
int main()
{
/* my first program in C */
printf("Hello, World! \n");
return 0;
}
C - Program Structure
 Let us look various parts of the above program:
 The first line of the program #include <stdio.h> is a preprocessor
command, which tells a C compiler to include stdio.h file before
going to actual compilation.
 The next line int main() is the main function where program
execution begins.
 The next line /*...*/ will be ignored by the compiler and it has been
put to add additional comments in the program. So such lines are
called comments in the program.
 The next line printf(...) is another function available in C which
causes the message "Hello, World!" to be displayed on the screen.
 The next line return 0; terminates main()function and returns the
value 0.
Compile & Execute C Program
Lets look at how to save the source code in a file, and how
to compile and run it. Following are the simple steps:
Open the program then click New Source File (text
editor) and add the code.
Save the file as hello.c
Then press the compile button to compile your code.
If there are no errors in your code, press Run button to
execute your program.
You will be able to see "Hello World" printed on the
black screen.
The Output
C - Basic Syntax
A C program consists of various tokens and a token is
either a keyword, an identifier, a constant, a string literal,
or a symbol. For example, the following C statement
consists of five tokens:
 printf("Hello, World! \n");
The individual tokens are:
printf
(
"Hello, World! \n“
)
;
Semicolons ;
In C program, the semicolon is a statement terminator.
That is, each individual statement must be ended with
a semicolon. It indicates the end of one logical entity.
For example, following are two different statements:
printf("Hello, World! \n");
Comments
Comments are like helping text in your C program and
they are ignored by the compiler. They start with /*
and terminates with the characters */ as shown below:
/* my first program in C */
You cannot have comments within comments and they
do not occur within a string or character literals
Identifiers
A C identifier is a name used to identify a variable,
function, or any other user-defined item. An identifier starts
with a letter A to Z or a to z or an underscore _ followed by
zero or more letters, underscores, and digits (0 to 9).
C does not allow punctuation characters such as @, $, and
% within identifiers. C is a case sensitive programming
language. Thus, Manpower and manpower are two different
identifiers in C. Here are some examples of acceptable
identifiers:
mohd /zara/ abc/ move/_name/ a_123/ myname50/ _temp/
j/ a23b9/ retVal
Keywords
The following list shows the reserved words in C.
These reserved words may not be used as constant or
variable or any other identifier names.
Assignment # 1
Read briefly about the history of C programming language.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy