Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Constants
- Integer Constants (int) 5 62 64 0 -78 45 -46 +ve number, -ve number , Zero
- Real Constant (float) 3.75 8.54 -5.3 -0.2
- Character constant (char) '5' 'a' 'V' '4' '+' '*' '9'
- Pi = 22/7= 3.14285714286.......... ---> floating Value
- 3.56 float Crt
- 'a' char crt
- 176 int Crt
- '125' char Error ' '=> Length within single quotes is 1
- 'name' char Error
- '95.5' char Error
- a int Error
- mukesh int Error
- .954 float Crt
- 'ad' error
- 34.3 float
- Me Error
- '0' Char
- '10.2' Error
- Normal Language C Language
- Alphabets Keywords-> int(integer) char(character) float(floating value)
- Words Meaning Operators -> + - * / [45->Operators]
- Sentence [Full stop] Seperators -> ; : {} ()
- Grammar --> Rules & Regulations Syntax-> format, Error
- What is a Keywords ?
- Keywords are Reserved or a predefined words it has a special Meaning. int(integer) char(character) float(floating)
- Ex: int ---> it represents Positive, Negative number and Zero
- char --> Character constants with ' ' Single quotes, with a length Only one
- Valid 'a' 'B' '2' '+'
- Invalid 'hello' '123' '1.2'
- Variables
- Maths
- 4x+2y=0 -> Equation
- 4x+2y -> Expression
- 4 -> Constant
- 2 -> Constant
- x -> Variable
- y -> Variable
- + -> Addition(Operation), Plus(Symbol)
- = -> is Equal to (Symbol) , Assignment(Operator)
- Assignment Operator (=)
- Conditions
- 1. It requires 2 argument Ex: a = 5
- 2. Left Side Argument must be variable. Ex: a = 6
- 3. Right Side Argument might be Variable (a=b), constant(a=5), Expression(a=5*2)
- 4. Left Side Argument is called L-Value a=12 a-> L-Value Error: lvalue required
- a=7 Invalid semi colon (;) is must
- a=5; Valid
- a=2; a-> 2 b->3 c-> 6
- b=3;
- c=2+4;
- a = ; Error Expression syntax error
- = b; Error
- Assignment Left Arg = Right Arg
- a=5; a-> 5 7
- b=7; b-> 7 8
- c=8; c-> 8 9
- d=9; d-> 9 7
- a=b;
- b=c;
- c=d;
- d=a;
- a=5; a-> 5 4
- b=-4; b-> -4 9
- c=9; c-> 9 +9 -9 -9=-9;
- a=-b;
- b=c;
- -c=-b;
- -a=-b; -4=-9 -5=x-y
- In L-value, Any variable with (-) changes into a expression . Expression gives a constant
- Priority
- a=2+3; 5
- +
- =
- a=2+3+5; 10 If Priorities same, (+) it starts from Left to right
- a=5+5;
- a=7-5+2; ->2+2;-> 4;
- a=5+2-7; ->7-7; 0;
- + -
- =
- a=2+3*5; 1.* 2.+ 3.=
- a=2+15; 17
- a=2*3+3*4;
- a=6+3*4;
- a=6+12;
- a=18;
- a=(2+3)*5;
- a=5*5;
- a=5*(3-1)+(3-1); 5*2+2; 10+2; 12;
- First Priority goes to the operator inside the ().
- () Changes the default priority.
- a=3*10/2; * / (same priority) Left to Right
- a=10/5/2;
- Maths C Lang
- + Add Sum + Sum
- - Sub Dif -
- X Mul product *
- / Div Quotient /
- Remainder %
- (/) Quotient - Result
- int/int => int
- int/float => float
- float/float => float
- float/int => float
- a=5/2; 2
- a=-5/2; -2
- a= 5/-2; -2
- a=-5/-2; 2
- a= 5.0/2; 2.5
- a=5/2.0; 2.5
- a=5.0/2.0; 2.5
- a=2/5; 0
- a= 2/5.0; 0.4
- a=2.0/5; 0.4
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement