0% found this document useful (0 votes)
31 views

C Intro

The document provides a course description for an Introduction to C Programming course. It includes details such as total lecture hours (45 hours of theory and 30 hours of practical), reference books, exam structure (50% internal assessment and 50% final exam with 10 marks for MCQ and 40 marks for subjective questions), and an 80% attendance requirement to be eligible to take the final exam. It also provides an introduction to C programming including what C is, its importance and characteristics, and the fundamentals of identifiers, constants, variables, and data types in C.

Uploaded by

Golden Crap
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views

C Intro

The document provides a course description for an Introduction to C Programming course. It includes details such as total lecture hours (45 hours of theory and 30 hours of practical), reference books, exam structure (50% internal assessment and 50% final exam with 10 marks for MCQ and 40 marks for subjective questions), and an 80% attendance requirement to be eligible to take the final exam. It also provides an introduction to C programming including what C is, its importance and characteristics, and the fundamentals of identifiers, constants, variables, and data types in C.

Uploaded by

Golden Crap
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 23

COURSE DESCRIPTION

Total Lecture Hours: 45 (15 Weeks * 3 hours of theory)


30 (15 Weeks * 2 hours of Practical)

Reference Book:

- Byron s. Gottfried, “Theory and Problems of Programming


with C, 2/e”, McGraw-Hill
- Brian W Kernighan/Dennis M. Ritchie, “The C Programming
Language 2/e” ,Prentice Hall
- YashavantP. Kanetkar, “Let Us C 5/e”, BPB publications
Exam:-
Internal: 50

Final: 50
10 marks MCQ
40 marks subjective

*80 % attendance compulsory in order to be eligible to


appear in FINAL EXAM
INTRODUCTION TO C PROGRAMMING
• General-purpose, structured programming language
Dividing program into blocks or parts and executing where one
block differs from other so that the reader can understand the
program easy
Statements are organized in a specific manner to minimize
error or misinterpretation
• C program, must be run through a C compiler to turn the
program into an executable that the computer can run
(execute).
• The C program is in human-readable form, while the executable
that comes out of the compiler is the machine-readable and
executable form
• Programs are highly portable
Programs written for one system can be run on other system
•Created by Dennis Ritchie at AT & T Labs in 1972
•Originally created to design and support the Unix operatwere only 32
keywords in the original version ing system
•There of Cfor, goto, if, else……
• Easy to build a compiler for C
There has been several written C compilers
C compilers are available for virtually every platform
•In 1983 the American National Standards Institute (ANSI) formed a
committee to establish a standard definition
•Called ANSI Standard C to avoid compatibility problems because
different organizations began using their own versions of C

Dennis Ritchie
Importance of C
• Robust language whose rich setup of built in functions
and operator can be used to write any complex
programs.
• Programs written in c are efficient due to several
variety of data types and powerful operators.
• The C complier combines the capabilities of an
assembly language with the feature of high level
language. Therefore it is well suited for writing both
system software and business package.
• C is portable language , meaning that c programs
written for one system can be run on another system,
with little or no modification.
Importance of C
• C language is well suited for structured
programming, this requires user to think of a
problems in terms of function or modules or
block. A collection of these modules make a
program debugging and testing easier.
• We can continuously add our own functions to
the library with the availability of the large
number of functions.
Characteristics of C
• Integrity: accuracy of the calculations
• Clarity: overall readability of the program, with particular
emphasis on its underlying logic
• Simplicity: keeping things as simple as possible, consistent
with the overall program objectives
• Efficiency: execution speed and efficient memory utilization
• Modularity: breaking down into a series of identifiable
subtasks; enhances the accuracy and clarity of program
• Generality: making programs as general as possible
C FUNDAMENTAL
Identifiers, Constants & Variables
• Identifiers
– Identifiers are names that are given to various program
elements, such as variables, functions and arrays.
– Identifiers consist of letters and digits, in any order, except
that the first character must be a letter .
– upper- and lowercase letters are permitted, though common
usage favors the use of lowercase letters for most types of
identifiers.
– The underscore character ( _ ) can also be included, and is
considered to be a letter .
– An underscore is often used in the middle of an identifier .
An identifier may also begin with an underscore, though
this is rarely done in practice
– Have standard predefined meanings in C
Identifiers, Constants & Variables
• Keywords can be used only for their intended purpose; they
cannot be used as programmer-defined identifiers
– Fixed meaning, cannot be changed
– Basic building block
– Lowercase
Identifiers, Constants & Variables
• int: integer quantity 2 bytes or one word
• char: single character 1 byte
• float: floating-point number 1 word (4 bytes) a
decimal point andor an exponent)
• double: double-precision floating-point number (i.e.,
more 2 words (8 bytes))
Identifiers, Constants & Variables
• Constants
– Fixed values
– Does not changes during execution of program
– Numeric constant – Integer (decimal, octal, hexadecimal)
and Real
– Character constant
• Single character constant
• String constant
• Backslash character constant
Identifiers, Constants & Variables

• A symbolic constant allows a name to appear in place of a


numeric constant, a character constant or a string
• When a program is compiled, each occurrence of a symbolic
constant is replaced by its corresponding character sequence
Eg #define PI 3.14
Identifiers, Constants & Variables
• Variables
– Data name used to store data value
– A declaration associates a group of variables with a specific
data type
– All variables must be declared before they can appear in
executable statements
– A declaration consists of a data type, followed by one or
more variable names, ending with a semicolon
– May take different values at different times during
execution Chosen by the programmer
E.g.
int a, b, c ; int a;
float root1 , root2; or int b;
char flag ; int c;
Identifiers, Constants & Variables

• Rules for variable declaration


– Can contain sequence of lowercase, uppercase letters, digits
and underscore
– Case sensitive my_num is not equivalent to My_num
– Initial character should not be a digit
– Use lowercase letters for variable names and UPPERCASE
letters for macro names
– Avoid using the variable name same as KEYWORDs
– Choose names that are meaningful
Identifiers, Constants & Variables
Data type
• Primary data types
• User defined data type
• Derived data type (array, function, structure,..)
• Empty data set
WRITING A C PROGRAM, COMPILING & EXECUTING
REQUIREMENTS

Text Editor (gedit)


• Compiler (gcc)
• C Standard Library
•OPENING TERMINAL
Applications System tools Terminal
•CHECK FOR gcc COMPILER
• gcc
An error message such as gcc: no input files
•CREATING WORKING DIRECTORY
• mkdir yourname_fac_rollno (eg dongol_CE_1)
• ls
• cd dongol_CE_1
• pwd
• gedit sample.c

You might also like