Professional Documents
Culture Documents
Instructor Led C Online Webinar Session - 1 PDF
Instructor Led C Online Webinar Session - 1 PDF
Instructor Led C Online Webinar Session - 1 PDF
WEBINAR
COACHING
BY APTUTS.COM
EMAIL: LEARN@APTUTS.COM
ABOUT ME
Bachelor's Degree in Computer Science Engineering
Software Engineer in IT Industry & Teaching Experience
7 Years of IT experience in various technologies
Expertise in C, C++, Application Development, Manual Testing, Web Automation Testing, Mobile
Automation Testing, Website Designing, PHP and VBScript
Founder of LearnCOnline.com, LearnCPPOnline.com and Aptuts.com
Contact Info: prashant@aptuts.com
COURSE CURRICULUM
Following topics would be covered:
Overview
Fundamentals and Control Statements
Data Input and Output in C
Functions and Function Overloading
OVERVIEW
C is a programming language developed by AT & Ts Bell Laboratories of USA in 1972. It was designed and written
by a man named Dennis Ritchie. C is reliable, simple and easy to use. C has survived for more than 4 decades.
Before starting with the programming, lets have a look at the C Character set.
Any alphabet, digit or special symbol can be termed as a character. Below are the list of valid alphabets, digits and
symbols allowed in C.
Alphabets:
A, B, C, D, ,X,Y, Z
a, b, c, d, ,x, y, z
Digits :
0, 1, 2, 3, 4, 5, 6, 7, 8, 9
Special Symbols :
~ ! @ # % ^ & * ( ) _ - + = | \ { } [ ] : ; " ' < > , . ? /
COMMENTS STATEMENTS
C supports two types of comments., // and /*...*/
Here, everything following // till the end of line is treated as comment.
Usually /*..*/ style is used for commenting out of a block code, whereas, // is used for singleline comments.
Example of single-line comment:
// This is a single line comment
Example of multiple-line comment:
/*This is
a multiple line comment*/
IDENTIFIERS
As stated before, identifiers are names that are given to various program elements such as variables,
constants, functions, arrays etc. There are certain rules regarding identifier names in C, as stated
below:
1.
Identifiers must consist of letters and digits, in any order, except that the first character must be a
letter
2.
3.
The underscore character (_) can also be included, and is considered to be a letter
4.
An identifier should contain enough characters so that its meaning is readily apparent
5.
There are certain reserved words, called keywords, that have standard, predefined meanings in C.
These keywords can be used only for their intended purpose. They cannot be used as a
programmer-defined identifiers
6.
It is required to note here that the keywords are all lower-case. Since upper-case and lower-case
characters are not equivalent, it is possible to utilize an upper-case keyword as an identifier
EXAMPLES OF IDENTIFIERS
Examples of valid identifiers:
z
x11
sum_1
_temperature
names
area
Examples of Invalid identifiers:
7th
a
order-no
error flag
KEYWORDS
As stated before, keywords are the words whose meaning has already been explained to the C
compiler (or in a broad sense to the computer).The keywords cannot be used as identifier
names because, if we do so, we are trying to assign a new meaning to the keyword, which is
not allowed by the computer.The keywords are also called Reserved words.
Examples of Keywords in C:
and
or
register
char
int
float
DATA TYPES
Data types supported by C can be broadly divided into six heads as stated follows:
1.
int data-type
2.
char data-type
3.
float data-type
4.
double data-type
5.
6.
DATA TYPES
int data-type:
int data-type represents the whole number (i.e., integer) quantities. Integers are required not to contain a decimal point or an
exponent
char data-type:
char data-type is used to represent individual characters. Hence, the char type generally requires only one byte of memory
float data-type:
float data-type (also called as floating point) represents values containing decimal places. A floating point value is distinguished by the
presence of a decimal point. It is permissible to omit digits before the decimal point, or digits after the decimal point, but obviously not
permissible to omit both.
double data-type:
double data-type is very similar to float data-type. It is used whenever the accuracy provided by a float variable is not sufficient.
Variables declared to be of type float can store roughly twice as many significant digits as can a variable of type float can store
bool (boolean) data-type:
This data type can take only two values true or false. It is commonly used to hold the results of comparisons
enum (enumeration) data-type:
ARITHMETIC OPERATORS
There are five arithmetic operators. They are:
1. Addition (+)
2. Subtraction (-)
3. Multiplication (*)
4. Division (/)
5. Remainder after integer division (%). The % operator is also sometimes referred to as
the modulus operator.
Example of the use of Arithmetic Operators:
Suppose that the x and y are integer variables whose values are 10 and 3 respectively. Several
arithmetic expressions involving these variables are shown below, together with their resulting
values:
x + y (Value: 13)
x y (Value: 7)
UNARY OPERATORS
C includes a class of operators that act upon a single operand to produce a new value. Such
operators are known as unary operators. Unary operators usually precede their single
operands, through some unary operators are written after their operands.
Perhaps the most common unary operation is unary minus, where a numerical constant, variable
or expression is preceded by a minus sign.
Note that the unary operation is distinctly different from the arithmetic operator which denotes
subtraction (-) as the subtraction operator requires two operands.
Example:
-175, -root1, -(x+y) etc.
RELATIONAL OPERATORS
There are four relational operators. They are:
1.
2.
3.
4.
Closely associated with the above mentioned relational operators are the following two equality
operators:
1.
== (equal to)
2.
a < b (True 1)
a == b (False 0)
c!=2 (True 1)
LOGICAL OPERATORS
A logical operator is used to compare or evaluate logical and relational expressions. There are three logical
operators. They are:
Operator
Meaning
&&
Logical AND
||
Logical OR
Logical NOT
An expression involving && or || is sometimes called compound expressions, since the expression involves two
other expressions, that is, each of these operators (&& and ||) takes two expressions, one to the left and
another to the right.
Example of && operator:
a > b && x == 10
The expression on the left is a > b and that on the right is x == 10. The above stated whole expression evaluates
to true (1) only if both the expressions are true (i.e., if a is greater than b and the value of x is equal to 10).
ASSIGNMENT OPERATORS
There are several different assignment operators. All of them are used to form assignment expressions, which
assign the value of an expression to an identifier.
The most commonly used assignment operator is =. Assignment expressions that make use of this operator are
written in the form:
identifier = expression
where,
identifier generally represents a variable, and
expression represents a constant, a variable or a more complex expression
Example:
a = 3;
x = y;
sum = a + b;
In the above statements, the first assignment expression causes the integer value 3 to assigned to the variable a,
and the second assignment causes the value of variable yto be assigned to x. In the third assignment, result in
the value of the arithmetic expression is assigned to the variable sum i.e., the value of a + b is assigned to sum.
CONDITIONAL OPERATOR
Simple conditional operations can be carried out with the conditional operator (? :). An expression that makes use of
the conditional operator is called a conditional expression. Such an expression can be written in place of the more
traditional if - else statement.
OUTPUT
Output in C is enabled by the statement printf which is predefined to corresponding to the
standard output stream.
Example of output statement in C:
printf(Welcome to Aptuts.com);
printf(This is a number %d, num);
INPUT
Contrary to printf, to receive input through the keyboard what is used is scanf
Example of using scanf:
scanf(&d, &num);
To enable the use printf and scanf, one needs to include a header file named stdio.h in the first
line of every program, by the statement:
#include <stdio.h>
This header file contains the declaration that are needed by printf & scanf statement Without
this declaration, the compiler won't recognize printf & scanf.
THANK YOU
Web: www.aptuts.com
Email: learn@aptuts.com
Social: www.facebook.com/aptuts