Getting Started with C
By
Mahalakshmi
1
What is C
C is a Programming Language developed at AT & T
Laboratories of USA in 1972.
The advantages of C languages are
Simple
Reliable
Easy to use
2
Steps in Learning C language
C Character Set
Constant,
Variable,
Keywords
Instruction
s Program
3
C Character Set
Character denotes any alphabet, digits or special
symbols used to represent information.
Alphabet A,B,…………Z
a,b,………….z
Digits 0,1,2,…9
Special Symbols !@#$%^&*()+_-;:,<.>/
?/|
4
Constants
The alphabet, Numbers and Special Symbols are
properly combined to form Constants. Constant is an
entity that does not change.
Types of Constant:
1)Primary Constant
i)Integer Constant
ii)Real Constant
iii)Character Contant
2)Secondary Constant
i)Array
ii)Pointer
iii)Structure.
5
Integer Constant
Rules for Constructing Integer Constant
At least one digit.
No decimal Point.
Either Positive or Negative.
If no sign proceeds then assumed to be positive.
No blanks or commas are allowed.
Example: 426
Character Constant
Rules for Constructing Character Constant
Single Alphabet, a Single digit or a Special symbol
enclosed within single inverted commas.
Maximum length is 1 character.
Example: ’s’
Variable
The Alphabet, Numbers and Special Symbols
properly combined to form Variables. Variable is an
entity that may change.
Rules for Constructing Integer Constant
Any Combination of albhabets, digits or numbers.
First character of variable name must be an alphabet
or underscore.
No special character used except underscore.
No blanks or commas are allowed.
Keywords
Keywords are the words whose meaning has been
explained to the C compiler.
The keyword cannot be used as the variable name.
32 keywords available in C.
auto break case char const
continue default Do Double else
enum extern float for goto
if int long register return
short signed sizeof static struct
switch typedef union unsigned Void
volatile while
First C Program
/* First C program*/
#include<stdio.h>
int main( )
{
int a,b,c;
a=10;
b=5;
/* Formula For AdDiTiOn*/
c=a+b;
Printf(“%dn”,c);
Return 0;
}
Comments: Enclosed within /* */.It is not necessary in
program. It is used to indicate the purpose of the program
and name of the author etc..,
main ( ) It is a function. A function is nothing but a set of
statements. All statements that belong to main( ) are
enclosed with in a pair of braces { }.
main( )
{
Statement 1;
Statement 2;
}
11
Arithmatic Operators: The arithmatic operators available
in C are +,-,*,/.
Printf( ): It is used to display the output.C doesnot contain
any readymade function to display the output. For that we
are using library function called printf( ).
Printf(“<format Specifier>”,<list of variables>);
<format String Can contain>
%f for printing real values
%d for printing integer values
%c for printing character values.
12
C Instruction
Types of Instructions in C
Type declaration Statement : used to declare the type of
variable used. Example: int,float,char.
Arithmatic Operation: Used to perform arithmatic
operations.
Control instruction: used to control the sequence of
execution of various statements in C program.

Chaptr 1

  • 1.
    Getting Started withC By Mahalakshmi 1
  • 2.
    What is C Cis a Programming Language developed at AT & T Laboratories of USA in 1972. The advantages of C languages are Simple Reliable Easy to use 2
  • 3.
    Steps in LearningC language C Character Set Constant, Variable, Keywords Instruction s Program 3
  • 4.
    C Character Set Characterdenotes any alphabet, digits or special symbols used to represent information. Alphabet A,B,…………Z a,b,………….z Digits 0,1,2,…9 Special Symbols !@#$%^&*()+_-;:,<.>/ ?/| 4
  • 5.
    Constants The alphabet, Numbersand Special Symbols are properly combined to form Constants. Constant is an entity that does not change. Types of Constant: 1)Primary Constant i)Integer Constant ii)Real Constant iii)Character Contant 2)Secondary Constant i)Array ii)Pointer iii)Structure. 5
  • 6.
    Integer Constant Rules forConstructing Integer Constant At least one digit. No decimal Point. Either Positive or Negative. If no sign proceeds then assumed to be positive. No blanks or commas are allowed. Example: 426
  • 7.
    Character Constant Rules forConstructing Character Constant Single Alphabet, a Single digit or a Special symbol enclosed within single inverted commas. Maximum length is 1 character. Example: ’s’
  • 8.
    Variable The Alphabet, Numbersand Special Symbols properly combined to form Variables. Variable is an entity that may change. Rules for Constructing Integer Constant Any Combination of albhabets, digits or numbers. First character of variable name must be an alphabet or underscore. No special character used except underscore. No blanks or commas are allowed.
  • 9.
    Keywords Keywords are thewords whose meaning has been explained to the C compiler. The keyword cannot be used as the variable name. 32 keywords available in C. auto break case char const continue default Do Double else enum extern float for goto if int long register return short signed sizeof static struct switch typedef union unsigned Void volatile while
  • 10.
    First C Program /*First C program*/ #include<stdio.h> int main( ) { int a,b,c; a=10; b=5; /* Formula For AdDiTiOn*/ c=a+b; Printf(“%dn”,c); Return 0; }
  • 11.
    Comments: Enclosed within/* */.It is not necessary in program. It is used to indicate the purpose of the program and name of the author etc.., main ( ) It is a function. A function is nothing but a set of statements. All statements that belong to main( ) are enclosed with in a pair of braces { }. main( ) { Statement 1; Statement 2; } 11
  • 12.
    Arithmatic Operators: Thearithmatic operators available in C are +,-,*,/. Printf( ): It is used to display the output.C doesnot contain any readymade function to display the output. For that we are using library function called printf( ). Printf(“<format Specifier>”,<list of variables>); <format String Can contain> %f for printing real values %d for printing integer values %c for printing character values. 12
  • 13.
    C Instruction Types ofInstructions in C Type declaration Statement : used to declare the type of variable used. Example: int,float,char. Arithmatic Operation: Used to perform arithmatic operations. Control instruction: used to control the sequence of execution of various statements in C program.