![Page 1: The C Character Set: The Characters used to form words, numbers and Expression depends upon the computer on which program runs. Letters. Digits White spaces](https://reader036.vdocuments.site/reader036/viewer/2022062718/56649e875503460f94b8b2c6/html5/thumbnails/1.jpg)
Basic of Computer & 'C' Programming 1
Unit 2 The C Character Set LECTURE 11
The C Character Set: The Characters used to form words, numbers and Expression depends upon the computer on which program runs.
Letters.
Digits
White spaces
Special characters
![Page 2: The C Character Set: The Characters used to form words, numbers and Expression depends upon the computer on which program runs. Letters. Digits White spaces](https://reader036.vdocuments.site/reader036/viewer/2022062718/56649e875503460f94b8b2c6/html5/thumbnails/2.jpg)
Basic of Computer & 'C' Programming 2
Unit 2 The C Character Set LECTURE 11
Character Set:
1.Letters 2.Digit 3.White Space
Capital A to Z All Decimal digit 0-9
Blank space , New Line
Small a to z Horizontal Tab, Vertical Tab
![Page 3: The C Character Set: The Characters used to form words, numbers and Expression depends upon the computer on which program runs. Letters. Digits White spaces](https://reader036.vdocuments.site/reader036/viewer/2022062718/56649e875503460f94b8b2c6/html5/thumbnails/3.jpg)
Basic of Computer & 'C' Programming 3
Unit 2 The C Character Set LECTURE 11
Special Characters:Symbol Name Symbol Name
, Comma \ Back Slash
. Dot or Period ~ Tilde
; Semi Colon _ Under score
“ Quotation Mark
$ Dollar
! Exclamation Mark
? Question Mark
| Vertical Bar ^ Caret
![Page 4: The C Character Set: The Characters used to form words, numbers and Expression depends upon the computer on which program runs. Letters. Digits White spaces](https://reader036.vdocuments.site/reader036/viewer/2022062718/56649e875503460f94b8b2c6/html5/thumbnails/4.jpg)
Basic of Computer & 'C' Programming 4
Unit 2 The C Character Set LECTURE 11
Delimiters:
Delimiters Uses
: Colon Useful for label.
; Semicolon Terminates statements.
( ) Parenthesis Used in expression & Function
[ ] Square Used for array Declaration
{ } curly Brace Scope of statement
# Hash Preprocessor directive
, Comma Variable separator
![Page 5: The C Character Set: The Characters used to form words, numbers and Expression depends upon the computer on which program runs. Letters. Digits White spaces](https://reader036.vdocuments.site/reader036/viewer/2022062718/56649e875503460f94b8b2c6/html5/thumbnails/5.jpg)
Basic of Computer & 'C' Programming 5
Unit 2 The C Character Set LECTURE 11
C Key Word: The c key words are reserved word by the compiler. All c keywords have been assigned fixed meaning. The keywords cannot be used as variable names because they have been assigned fixed job. E.g
Auto, Break, Case, Char, Const, Default, Continue, Do, Double, Else, If, Float, Int ,For, While, Void, Switch, Return, Long, struct
![Page 6: The C Character Set: The Characters used to form words, numbers and Expression depends upon the computer on which program runs. Letters. Digits White spaces](https://reader036.vdocuments.site/reader036/viewer/2022062718/56649e875503460f94b8b2c6/html5/thumbnails/6.jpg)
Basic of Computer & 'C' Programming 6
Unit 2 The C Character Set LECTURE 11
Identifiers:- Identifiers are names of variable, function and arrays. They are user-defined names consisting of sequence of letters and digit with the letters as the 1st character. Lower case letters are preferred. However the upper case letters are also permitted. The (-) underscore symbol can be used as an identifier. In general underscore is used as a link between two words in long identifiers.
Example:
#define N 10
#define a 15
Here N, a are user define identifiers.
![Page 7: The C Character Set: The Characters used to form words, numbers and Expression depends upon the computer on which program runs. Letters. Digits White spaces](https://reader036.vdocuments.site/reader036/viewer/2022062718/56649e875503460f94b8b2c6/html5/thumbnails/7.jpg)
Basic of Computer & 'C' Programming 7
Unit 2 The C Character Set LECTURE 11
Constants: The constants in c are applicable to the values, which do not change during the execution of a program.
1.Numeric Constant 2. Character Constant.
a) Integer Constant a)Single Char Constant
b) Real Constant b)String Constant
![Page 8: The C Character Set: The Characters used to form words, numbers and Expression depends upon the computer on which program runs. Letters. Digits White spaces](https://reader036.vdocuments.site/reader036/viewer/2022062718/56649e875503460f94b8b2c6/html5/thumbnails/8.jpg)
Basic of Computer & 'C' Programming 8
Unit 2 The C Character Set LECTURE 11
Variables: A variable is a data names used for storing a data values. Its value may be changed during the program execution.
Example: Height, Average, Sum, etc.
![Page 9: The C Character Set: The Characters used to form words, numbers and Expression depends upon the computer on which program runs. Letters. Digits White spaces](https://reader036.vdocuments.site/reader036/viewer/2022062718/56649e875503460f94b8b2c6/html5/thumbnails/9.jpg)
Basic of Computer & 'C' Programming 9
Unit 2 The C Character Set LECTURE 11
Data Types: All c compilers support a variety of data types. This enables the programmer to select the appropriate data types as per the need of the application. Generally data is represented using numbers or characters.
![Page 10: The C Character Set: The Characters used to form words, numbers and Expression depends upon the computer on which program runs. Letters. Digits White spaces](https://reader036.vdocuments.site/reader036/viewer/2022062718/56649e875503460f94b8b2c6/html5/thumbnails/10.jpg)
Basic of Computer & 'C' Programming 10
Unit 2 The C Character Set LECTURE 11
Data types and their control strings.
Data Types Size Range Format string
Char 1 -128 to 127 %c
Unsigned Char 1 0 to 255 %c
Short or int 2 -32768 t0 32767 %i or %d
Unsigned int 2 0 to 65535 %u
Long 4 -2147483648 to 2147483647
%ld
Unsigned Long 4 0 to 4294967295 %lu
Float 4 3.4 e -308 to 1.7 e +308 %lf
Double 8 1.7 e -308 to 1.7 e +308 %lf
![Page 11: The C Character Set: The Characters used to form words, numbers and Expression depends upon the computer on which program runs. Letters. Digits White spaces](https://reader036.vdocuments.site/reader036/viewer/2022062718/56649e875503460f94b8b2c6/html5/thumbnails/11.jpg)
Basic of Computer & 'C' Programming 11
Unit 2 The C Character Set LECTURE 11
Operators & Expression
Operator:
Arithmetic Operator- +, -, *, /, %.
Logical- &&, ||, !
Relational - <,>,<=,>=
Increment - ++
Decrement –
![Page 12: The C Character Set: The Characters used to form words, numbers and Expression depends upon the computer on which program runs. Letters. Digits White spaces](https://reader036.vdocuments.site/reader036/viewer/2022062718/56649e875503460f94b8b2c6/html5/thumbnails/12.jpg)
Basic of Computer & 'C' Programming 12
Unit 2 The C Character Set LECTURE 11
Unary Arithmetic Operates:-
Operator Description or Action
- Minus
++ Increment
- - Decrement
& Address Operator
Size of Give the size of variable
![Page 13: The C Character Set: The Characters used to form words, numbers and Expression depends upon the computer on which program runs. Letters. Digits White spaces](https://reader036.vdocuments.site/reader036/viewer/2022062718/56649e875503460f94b8b2c6/html5/thumbnails/13.jpg)
Basic of Computer & 'C' Programming 13
Unit 2 The C Character Set LECTURE 11
Ex-1 x=37 , y=5
(a) x+y =42
(b) x-y =32
(c) x*y =185
(d) x/y =7
(e) x%y =2.
![Page 14: The C Character Set: The Characters used to form words, numbers and Expression depends upon the computer on which program runs. Letters. Digits White spaces](https://reader036.vdocuments.site/reader036/viewer/2022062718/56649e875503460f94b8b2c6/html5/thumbnails/14.jpg)
Basic of Computer & 'C' Programming 14
Unit 2 The C Character Set LECTURE 10
Ex-2 #include<stdio.h>
void main()
{
int x,y,z,a,b,c,d;
x=22;
y=3;
a=x+y;
b=x-y;
c= x/y;
z=x*y;
d=x%y;
printf(“a=%d,b=%d,c=%d,z=%d,d=%d\n”,a,b,c,z,d); }
a=25, b=19, c=7, z=66, d=1
![Page 15: The C Character Set: The Characters used to form words, numbers and Expression depends upon the computer on which program runs. Letters. Digits White spaces](https://reader036.vdocuments.site/reader036/viewer/2022062718/56649e875503460f94b8b2c6/html5/thumbnails/15.jpg)
Basic of Computer & 'C' Programming 15
Unit 2 The C Character Set LECTURE 11
Increment operator + + Decrement Operator - - Q- Find the Output of the following programs 1. int i; i=2; printf(“i=%d”,i); i=2 printf(“i=%d\n”,++i); i=3 printf(“i=%d\n”,i); i=3
![Page 16: The C Character Set: The Characters used to form words, numbers and Expression depends upon the computer on which program runs. Letters. Digits White spaces](https://reader036.vdocuments.site/reader036/viewer/2022062718/56649e875503460f94b8b2c6/html5/thumbnails/16.jpg)
Basic of Computer & 'C' Programming 16
Unit 2 The C Character Set LECTURE 11
int i; i=2; printf(“i=%d\n”,i); i=2 printf(“i=%d\n”,i++); i=2 printf(“i=%d\n”,i); i=3int m,y; m=3; y=++m; pritnf(“y=%d\n”,y); y=4 y=m++; printf(“y=%d\n”,y); y=4 printf(“m=%d\n”,m); y=5
![Page 17: The C Character Set: The Characters used to form words, numbers and Expression depends upon the computer on which program runs. Letters. Digits White spaces](https://reader036.vdocuments.site/reader036/viewer/2022062718/56649e875503460f94b8b2c6/html5/thumbnails/17.jpg)
Basic of Computer & 'C' Programming 17
Unit 2 The C Character Set LECTURE 11
Find the output of the following programs 1. int m,n; m=3; n=3; ++m; n++; printf(“m=%d and n=%d\n”,m, n);
m=4 & n=4
![Page 18: The C Character Set: The Characters used to form words, numbers and Expression depends upon the computer on which program runs. Letters. Digits White spaces](https://reader036.vdocuments.site/reader036/viewer/2022062718/56649e875503460f94b8b2c6/html5/thumbnails/18.jpg)
Basic of Computer & 'C' Programming 18
Unit 2 The C Character Set LECTURE 11
2. int m,n;
m=3;
n=3;
printf(“m=%d and n=%d\n”,++m,n++); m=4 & n=3
find the Output of the following programs
#include<stdio.h>
void main()
{
i,j,m,n;
i=9;
j=11;
m=++i/2-2;
printf(”m=%d\n”,m);
n=j++ -1;
printf(“n=%d\n”,n); } m=3n=10
![Page 19: The C Character Set: The Characters used to form words, numbers and Expression depends upon the computer on which program runs. Letters. Digits White spaces](https://reader036.vdocuments.site/reader036/viewer/2022062718/56649e875503460f94b8b2c6/html5/thumbnails/19.jpg)
Basic of Computer & 'C' Programming 19
Unit 2 The C Character Set LECTURE 11
Q. Find the value of c & d
2nd a,b;
a=2;
b=3; c=6,d=12
c=++a;
c*=2;
d=b++;
d*=b;
![Page 20: The C Character Set: The Characters used to form words, numbers and Expression depends upon the computer on which program runs. Letters. Digits White spaces](https://reader036.vdocuments.site/reader036/viewer/2022062718/56649e875503460f94b8b2c6/html5/thumbnails/20.jpg)
Basic of Computer & 'C' Programming 20
Unit 2 The C Character Set LECTURE 11Q.Find the output of following Program:-
#include<stdio.h>
main()
{
i,j,k;
i=10;
j=5;
k=++i-j;
printf(“k=%d\n”,k);
k=i++ +j;
printf(“k=%d\n”,k);
}
K=6
K=16
![Page 21: The C Character Set: The Characters used to form words, numbers and Expression depends upon the computer on which program runs. Letters. Digits White spaces](https://reader036.vdocuments.site/reader036/viewer/2022062718/56649e875503460f94b8b2c6/html5/thumbnails/21.jpg)
Basic of Computer & 'C' Programming 21
Unit 2 The C Character Set LECTURE 11
Q. Find the output of following.
#include<stdio.h>
main()
{
int x,z;
x=6;
z=++x + x++;
printf(“z=%d\n”,z);
printf(“x=%d\n”,x);”
}
z=14,x=8
![Page 22: The C Character Set: The Characters used to form words, numbers and Expression depends upon the computer on which program runs. Letters. Digits White spaces](https://reader036.vdocuments.site/reader036/viewer/2022062718/56649e875503460f94b8b2c6/html5/thumbnails/22.jpg)
Basic of Computer & 'C' Programming 22
Unit 2 The C Character Set LECTURE 11
Q. Find the output of the following program.
#include<stdio.h>
int x;
int z;
x=6;
z=x++ + ++x;
printf(“z=%d and x=%d\n”,z,x);
}
z=14; x=8;
![Page 23: The C Character Set: The Characters used to form words, numbers and Expression depends upon the computer on which program runs. Letters. Digits White spaces](https://reader036.vdocuments.site/reader036/viewer/2022062718/56649e875503460f94b8b2c6/html5/thumbnails/23.jpg)
Basic of Computer & 'C' Programming 23
Unit 2 The C Character Set LECTURE 11
Q. Find the output of following program.
#include<stdio.h>void main()
{
int x,y,z;
x=7;y=3;
x=x++ + y++;
printf(“z=%d x=%d y=%d\n”,z,x,y);
}
z=14 and x=8
![Page 24: The C Character Set: The Characters used to form words, numbers and Expression depends upon the computer on which program runs. Letters. Digits White spaces](https://reader036.vdocuments.site/reader036/viewer/2022062718/56649e875503460f94b8b2c6/html5/thumbnails/24.jpg)
Basic of Computer & 'C' Programming 24
Unit 2 The C Character Set LECTURE 11
Thanks
![Page 25: The C Character Set: The Characters used to form words, numbers and Expression depends upon the computer on which program runs. Letters. Digits White spaces](https://reader036.vdocuments.site/reader036/viewer/2022062718/56649e875503460f94b8b2c6/html5/thumbnails/25.jpg)
Basic of Computer & 'C' Programming 25
Unit 2 The C Character Set LECTURE 11