C
What is an operator in C? | modify operators in c
hi everyone so in the last session we
discussed what is the basic things of
modifier operators right how to evaluate
an expression so which contain some
modify operators so what are the main
five steps we need to follow what all
the main five steps we need to follow
evaluate the expression of a modifier
discussed what is the basic things of
modifier operators right how to evaluate
an expression so which contain some
modify operators so what are the main
five steps we need to follow what all
the main five steps we need to follow
evaluate the expression of a modifier
What does the += operator do in C?
operators and two basic examples we haveseen so those programs describes so what
is the difference between increment
operator and decrement operator we will
see some more examples right so exactly
how a modifier operators will execute
see so one example so main int 3
variables suppose x value 10 y value 20
+ Z and here it is a simple expression Z
is equals to X plus plus is multiplied
with a minus minus y minus minus y and
here it is so we are printing printf
printf all the three variables X Y Z we
are printing X Y Z so now this
expression evaluation using five steps
same story what is the first step pre
increment and pre-decrement here it is
how many pre increments are there no pre
increment how many pre decrements are
there yes pre-decrement is there why
decrease the value Y value is 19 Y value
19 next second step is substitution of
values just substitute the values x
value is 10 is multiplied with Y value
19 second step over third step
evaluation yes now expression is there
evaluate 10 is multiplied with 19 value
1 9
What is an operator in C?
next step assignment 190 the valueassigned to Z so now the Z value is 190
190 and the last step is post increments
and post decrements how many post
increments are there and how many post
decrements are there see this is post
increment X so increase the x value x
value 11 and here it is any post
decrement is not there so five steps
over evaluation over next the control
come to that next one x value so what is
the x value 11 it will print what is the
Y value 19 it will print and what is the
Z value 190 it will print this is
execution please do not get any
confusion if you take one expression
which contains increment and decrement
operators just follow these five steps
okay see the next example only one
variable we are taking main int X is
equals to 5 X is equals to 5 and this is
the one X is equal to X plus plus plus
plus plus X and here we are printing the
x value printf x value we are printing
in the next statement write how it
What are the different types of operators in C?
executes just follow the same five stepsonce again first step pre increment and
pre-decrement how many pre increments
are there only one pre increment is
there that is plus plus X so X value
become 6 very very important thing
whenever it is updated to 6 there is no
5 just forget about the 5 now x value is
6 5 you are not storing in any other
place so that is replaced by 6 in
memory now x-value is a six come to that
second step substitution of values
substitute the x value right what is
that x value 6 so substitute 6 here and
substitute 6 here also not 5
no more 5 is already gone that is
replaced with the value 6 second step is
over
third step evaluation just evaluate add
6 plus 6 value 12 right next step is a
assignment the 12 value will be assigned
to X only so X value now 12 and the last
step is post increment and post
decrement in the expression here post
increment is there now post increment
execute X value is increased by one
what is it X value is 12 that will
become 13 now expression evaluation
completed now finally in the last step
we are printing the x value what is the
x value is 13 x value is what 13 okay
and see first post increment pre
increment execute after pre increments
substitution of values next evaluation
and then assignment and the last step is
a post increment so the final value is a
13 next example suppose here two
variables we are taking now int a value
is 2 B value is 3 B equals to a plus
plus plus B minus minus a equals to a
minus minus plus plus plus B and again B
is equals to plus plus a plus minus
minus B and finally we are printing
values of a and B
we are printing the values of a and B
now execution again every step nothing
but every expression you should execute
with the help of these five steps first
step pre increment and pre-decrement any
pre increment and pre-decrement no is
not there so directly come to the second
step
What is the increment operator in c language?
substitute the values a value substitutetwo plus B value substitute three next
evaluation 2 plus 3/5 next assignment so
5 will be assigned to B Phi will be
assigned to B so what is the B value is
now 5 and next last step post increment
and post decrement post increment of a
post increment of a post increment of B
so B value become 4 so after first
expression evaluation so values are a
value is a 3 and B value is a 4 and next
here it is post and one is a pre so
second expression execution same 5 steps
we need to follow first plus plus B
execute because pre increment and
pre-decrement first plus plus B means B
value become 5 second step substitution
of values a value substitute value is 3
plus B value is a 5 B value is a 5 and
next step is evaluation 3 + 5 8 next
step is assignment 8 will go and store
here into a so a value is 8 now and the
last step is a value post decrement all
the 5 steps very very important after
assignment you are thinking that
expression execution completed no last
step is there posting
and post decrement so a value already 8
so that is post decrease that is become
7 second step completed now third step
both are pre only one is the pre
increment and second one is a
pre-decrement so pre increment and
pre-decrement plus plus a value become 8
minus minus B value become 4 next step
substitution 8 plus 4 evaluation 12
assignment 12 will be assigned to B so B
value is 12 and the last step is post
increment and post decrement any post
increment and post decrement here
no so execution over so at last we are
printing the values of a and B so here a
value is 8 and B value is 8 well
evaluate and B value 12 ok so here so
this is a program how it executes sir
after execution of this program so where
I did a mistake if I want to know I am
unable to analyze so these many steps at
a time no problem after every step you
please write a printf a B value sprint
here and a B values print here a B
operator in c
values print here a B values print hereafter every step if you print in which
step you did the mistake that you will
understand very easily ok suppose here
it is printing the expected values what
you expected the same values then there
is no problem in this expression then
you should go for second expression and
next go for third expression and will
check the final as a basic programmer if
you are in a learning stage only so
later anyway how many number of
expressions no matter easily you will
understand okay so this is a simply
about increment operators and decrement
operators execution increment operators
and decrement operators
next go for third expression and will
check the final as a basic programmer if
you are in a learning stage only so
later anyway how many number of
expressions no matter easily you will
understand okay so this is a simply
about increment operators and decrement
operators execution increment operators
and decrement operators
and one more simple point we'll discuss
right see what is the C here C language
is not the space consistent that is
nothing but here a value is a 5 and in
next step we are writing like this e
equals to a plus plus plus a the system
will accept this expression so because
how many number of plus symbols we are
placing depend on that compiler
internally will change nothing but will
store will add some spaces to evaluate
that expression here so what is the
confusion observed it will convert into
two types J equals to a plus plus plus a
second one a equals to a plus plus plus
a two options we have for how system
will treat this one or this one when
compared with the automatic operators
modify operators only having highest
priority when compared with the
automatic operators modify operators
having highest priority so first it will
consider priority is given to modify
operator a plus plus and then next
priority is given to our thematic
operator so this is wrong actually if
you evaluate this right what is the
output you will get what is the output
same five steps only you have to follow
first one is a pre increment so nothing
but a value becomes six six will be
substituted six plus six a value 12 you
will get but come to here right same
five steps we need to follow first post
increment will not execute only pre
increment so a value will substitute
directly 5+5 10 will be assigned later
What is an operator in C?
the value become 11 because a postincrement is there sir which is the
correct answer how system treats means
this is the correct answer this is not a
reason it will give the first
to modify operators when compared with
the automatic operators our thematic
operator highest priority means
automatic operator will come first right
a modify operator is having highest
priority so it is correct system reads
like this okay so this is all about a
modified operators increment and
decrement operators hope everyone will
enjoy this session right for more articel

Post a Comment
0 Comments