Académique Documents
Professionnel Documents
Culture Documents
C language
Chapter1
Lecture1
Ans: c language is portable language means programs can many different computer
Lecture2
Que: what are library files? And which extension they have?
Ans: library files are group of precompiled routines for performing specific tasks
and they have extension of .lib
Ans: printf function is used to display text on the screen You can use printf() to
print numbers, strings or characters
Ans: you are going to use floating-point arithmetic in your programs; you will
need another library file
Que: what are run time object files? And which extension they have?
Ans: files contain the code to perform various functions after your program is
running and they have extension of .OBJ
Que: what are header files or include files? And which extension they have?
Ans: are text files can be combined with your program before it is compiled and
they have extension of .h
Ans: Use an editor to create a disk file containing your source code
with extension of c.
Ans: The function is the one to which the control is passed when the program is
executed
Ans: The Opening brace {indicates that a block of code that forms a distinct unit
is about to begin. The closing brace} terminates the block of code
Ans: The line in our program begins with the word printf() is an example of a
statement
Ans: In C Strings are surrounded with Double quotes while characters are
surrounded with single quotes
Chapter2 lecture 1
Computer programs usually work with different types of data, these values
can be numbers or characters.
C has two ways of storing values, variables and constants.
A variable is a data storage location that has a value that can change during
program execution.
Variables may be the most fundamental aspect of any computer language.
A constant has a fixed value that can't change.
The variable name of c can contain letters, digits, and the underscore,
the first character of the name must be a letter.
C keywords can't be used as variable names.
A keyword is a word that is part of the C language.
Prepared by BIT22 and BCS09
A variable declaration tells the compiler the name and type of a variable
and optionally initializes the variable to a specific value.
Variable definition specifies the name and the type of a variable, and also
sets aside memory space for the variable.
A variable declaration, by contrast, specifies variables name and data type
but doesnt set aside any memory for the variable.
Variable declarations are important in multifile program, where a variable
definition that is defined in one file must be referred to in second file.
Chapter2 lecture2
Prepared by BIT22 and BCS09
The scanf is input function allows you to accept input from standard in,
which for us is generally the keyboard.
Scanf introduces two new symbols; the arithmetic operator (*) and the
address operator (&).
The scanf () function can accept input to several variables at once.
An address operator is a mechanism within C that returns the memory
address of a variable.
getche () is input function reads a single character from the keyboard and
echoes to the screen.
The get means it gets something from the outside world.
The ch means it gets a character.
The e means it echoes the character to the screen when you type it.
A statement is a complete direction instructing of the computer to carry out
some task.
In C, statements are usually written one per line, although some statements
span multiple lines.
White space refers to spaces, tabs, and blank lines in your source code.
If you place a semicolon by itself on a line, you create a null statement.
A compound statement, also called a block, is a group of two or more C
statements enclosed in braces.
An expression is anything that evaluates to a numeric value.
The simplest C expression consists of a single item: a simple variable, literal
constant or symbolic constant.
Complex expressions consist of simpler expressions connected by
operators. E.g.: 5+4.
Prepared by BIT22 and BCS09
An operator is a symbol that instructs C to perform some operation, or
action, on one or more operands.
An operand is something that an operator acts on.
C language has four operators:
1. The assignment operator: is the equal sign (=).
Its use in programming is somewhat different from its use in regular
math.
In a C assignment statement, the right side can be any expression,
and the left side must be a variable name.
2. Mathematical Operators (arithmetic): takes two operands.
binary mathematical operators
c.Muliplication (*)
C has six relational operators: equal (==), Less than (<), greater than
(>),
Prepared by BIT22 and BCS09
Greater than or equal (>=), less than or equal (<=), and not equal
(! =).
Chapter4