Modify Operators | C Technical Interview Questions and Answers | Mr. Srinivas
Vložit
- čas přidán 4. 09. 2024
- Modify Operators | C Technical Interview Questions and Answers | Mr. Srinivas
** For Online Training Registration: goo.gl/r6kJbB ► Call: +91-8179191999
Subscribe to our channel and hit the bell 🔔🔔🔔 icon to get video updates.
💡 Visit Our Websites
For Classroom Training:nareshit.in/c-...
For Online Training: nareshit.com/c...
#Clanguage #Programming #Tutorials #Course #Training
--------------------------
💡 About NareshIT:
"Naresh IT is having 14+ years of experience in software training industry and the best Software Training Institute for online training, classroom training, weekend training, corporate training of Hadoop, Salesforce, AWS, DevOps, Spark, Data Science, Python, Tableau, RPA , Java, C#.NET, ASP.NET, Oracle, Testing Tools, Silver light, Linq, SQL Server, Selenium, Android, iPhone, C Language, C++, PHP and Digital Marketing in USA, Hyderabad, Chennai and Vijayawada, Bangalore India which provides online training across all the locations
--------------------------
💡 Our Online Training Features:
🎈 Training with Real-Time Experts
🎈 Industry Specific Scenario’s
🎈 Flexible Timings
🎈 Soft Copy of Material
🎈 Share Videos of each and every session.
--------------------------
💡 Please write back to us at
📧 us.training@nareshit.com/ 📧 online@nareshit.com or Call us at the USA: ☎+1404-232-9879 or India: ☎ +918179191999
--------------------------
💡 Check The Below Links
► For Course Reg: goo.gl/r6kJbB
► Subscribe to Our Channel: goo.gl/q9ozyG
► Circle us on G+: plus.google.co...
► Like us on Facebook: / nareshit
► Follow us on Twitter: / nareshitek
► Follow us on Linkedin: goo.gl/CRBZ5F
► Follow us on Instagram: goo.gl/3UXYK3
Please Comment, Subscribe and Click Bell🔔🔔🔔 Icon for More Updates. To learn software course from our experts please register here for online training: @t
Sir answer is 9 and 19
sir output on "vs code" and "code block" is 19 and 9 but "blue & black" on output is 18 and 8 . pls explain.....
wrong answer
Sir, in first expression a = 4 and b = 9. And second expression a = 19 and b = 9.
Sir you have gone wrong here. Answer for a = 19 and b = 9.
Turbo c compiler ans is : 18,8
gcc compiler ans is : 19,9
output is depend on your compiler (software)
right bro..
@@rahuljathar9429 ggc compiler dusra method use karta hai solve k lie? or yadi hai to bata do bhae kaise , mujhe samjh nae a rhi problem.
In turbo c++ 18 and 8
check with changing a-- by a no change occur
Turbo c compiler ans is : 18,8
gcc compiler ans is : 19,9
output is depend on your compiler (software)
Thank u bro, you clarified my doubt
Sir, I think there is a problem in calculation. When I calculated myself I got 19, 9. And after compiling I got the same as output from my machine. Would you please explain?
yes, the same case happening at my side too.
Which compiler do you use?
@@atom7004
Which compiler do you use?
Same here. I am using Code Blocks 20.03. But there are two warning messages :
warning: operation on 'a' may be undefined [-Wsequence-point]|
warning: operation on 'b' may be undefined [-Wsequence-point]|
int a=4, b=5;
b = a++ + a--;
a = ++b + b--;
b = 4(now a=5 bcoz post inc)
+ 5( now a=4 bcoz post dec)
So now b = 4+5=9 and now b value is 9 not 5
a = 10(now b=10 bcoz pre inc)
+ 10(now b =9 bcoz post dec)
So last updated value of b = 9
And a = 10 + 10 = 20
exactly
..
Right 👍,I got same ans
Crystal clear concept 🙏
That's the only place where I learnt a lot.... Tysm sir
Sir,as different compilers uses different method for solving this equation.so we student are confusing right now because our answer is not matching with your answer...yet you are right in solving this..but then also we are not getting so make a video to tell us difference of compiler to compiler...and which one is valid method to solve this equation.....plz reply sir.....
In today's compiler the concept used by sir is not used..... modern IDE includes ATOM,CODE BLOCK which uses GCC COMPILER and they have entirely different concept to solve this problem IF U WANT TO LEARN THAT CONCEPT I WILL recommend
you to go through this youtube channel they have modern concept and easy way for understanding whole concept czcams.com/video/yRt-zYFJIvE/video.html
sir your answer is wrong :
#include
int main(void) {
int a=4,b=5;
b = a++ + a--;
a= ++b+b--;
printf("%d %d
",a,b);
}
this is giving me a = 20,b = 9
i=4;
j= ++i*i++;
i calculated by your method j=25 but compiler giving j=30.
help!!!!
thats y u must always use best compiler...
Same 😢
Thanks sir you are fabolous fantastic stunning
I compiled it also in Dev C Apllication..
Output is. " 19 9".
Guys make sure it
Wrong,final value should be a=19 & b=9
Sir please discuss more equation with the combination of both increment and decrement operator on the same line of equation
Thank u 🙏 sir..!?
a value is 19, b is 9
Superb sir 🙏🙏
Hi op comes 19 9 please upload again
Sir its wrong actually ans is a=19,b=9
It depends on compiler
hello sir from my prespective i think sir this is the wrong explanation first increment and decrement operation then addition I think this make sence
Turbo c compiler ans is : 18,8
gcc compiler ans is : 19,9
output is depend on your compiler (software)
According to Turbo C++ Version 3.0,
Output: a = 18, b = 8
thanks a lot sir...
main()
{
int z, x=5, y=-10, a=4, b=2;
z=x++ - --y * --b / a;
printf("%d ",z);
}
Output will be 7, how?
Thankyou sir
this method is wrong for solving expression
Please tell me Right Ans. Process
@@akshaymdeshmukh764 refer codechamp channel bro you will get
@@saitejateegala2986 I got it from codechamp somedays before. Thank you Sai...
Thank you
super sir.
Output is 19,9 , i will give better explanation then you
Sir please verify , Is this right ?
I wrote the same code and got O/P 20 and 9
It depends on compiler also...not same output for different compiler
I got too
I got result as same result of you nice one tq
thnx .
Hi sir,
Can you please Execute and let me know the answer
i got the answer 19,9
Yes
Same
Sir answer is 9 and 19
answer is 19 and 9 sir u went wrong
Turbo c compiler ans is : 18,8
gcc compiler ans is : 19,9
output is depend on your compiler (software)
Hi Sir. Can you explain how it will print 5 here.
V1=2, V2;
V2=V1++ + V1++;
printf("%d", v2) ;
1. step) left v1++ = 2, v1 = 3
2. step) right v1++ = 3, v1 = 4
3. step) v2 = v1++ + v1++ = 2 + 3 = 5, v1 = 4
V1 is 2 here . So use it in equation the change it into 3...So, 2+3=5 is the value of V2 and value of V1 is 4
sir ,answer is wrong!
Ans is wrong ,it is 19,9 in both 32 bit and 64 bit compiler
#include
int main()
{
int i = 1;
printf("%d %d %d
", i++, i++, i);
return 0;
}
sir wat is d output of this
2,1,3
could you please explain?
Shifa Sultana 1,2,3
211
This type of expression always evaluted from right to left .So,the ans is.... 2 1 1
U also visit the link : www.c4learn.com/c-programming/increment-operator-inside-printf/
Video visual clarity ledu ra
dammn my compiler is showing a =19 and b = 9 ; am i wrong dude?
Anna b=9
Sir u have done wrong please cross check once
Solving with right method, we get 20,9 answer
Brother, according to mingw and gcc compiler a = 19 b = 9.
Solving with right method, the answer is 19,9
No follow the concept of increment operators and do it properly, u will get output as 20,9
19 , 9 only boss
Hello , using Code:blocks and the OP: of the program is :19,9
Can you please give us a feedback why we are getting diffrent results?
P.S kepp up the good work :) !
its because of the compiler different compiler gives different lexical values based on the tokens generated by the threads
stupid answer . The actual answer is that modify operators have higher precedence than airthematic . so first whole expression is evaluated for modify operators then value is subsituted and then the expression is evaluated
In today's compiler the concept used by sir is not used..... modern IDE includes ATOM,CODE BLOCK which uses GCC COMPILER and they have entirely different concept to solve this problem IF U WANT TO LEARN THAT CONCEPT I WILL recommend
you to go through this youtube channel they have modern concept and easy way for understanding whole concept czcams.com/video/yRt-zYFJIvE/video.html
@@lawn_mower4941
this is ok all discusion
Output is 20 and 9.
He is completly wrong
Its output is a=20; b=9; i executed in jdk
*Output:* 20, 9
19,9
Turbo c
compiler ans is : 18,8
gcc compiler ans is : 19,9
output is depend on your compiler (software)
@@murgan4307bro don't follow the compiler, follow the concept of increment operators and do it properly, u will get the output as 20,9
Answer is wrong !! ...wrong explanation
Hi Sir,
I wrote this program in C and it gave me a result of 19, 9. Can anyone explain?
Thanks
same
It depend on compiler....
The value comes 19 and 9 becz of the order of evaluation and also due to the cause of no any sequence point in the first expression to evaluate b..
b undergoes evaluation like this:
As post increment and post decrement are of same precendence hence
b=4+5=9
First in a++ the value of a is substituted and then it gets incremented and after that in a-- value of incremented 'a' is substituted and then it undergoes decrement by 1 Hence result comes 9
@@mdnizamraza7939 a comes out to be 20
I think correct answer is a=11 and b=9....
Why answer becomes 19 9 why +1
The answer must be 9,20 .
Hindi me translation
Listen all java is better than c
And you listen python is better than java
@@softwarefoodiee na not yet listened 😒
int i=5;
printf("%d %d
", i, i=i++) ;
printf ("%d
", i);
i=i++;
printf ("%d
", i);
I am getting output as
5 5
5
6
Why there is no change inside printf statement but outside printf there is a change!!!
I compiled this in turbo C compiler
Try by storing i++ in another variable then there will be change
i++ ---> 1)old value is assigned 2) then increment is done
++i--> 1)value is incremented 2)new value is assigned.
Ex:-
#include
int main()
{
int a=5;
printf("%d",a++);
printf("%d",a);
printf("%d",++a);
printf("%d",a);
}
The output of your code will be
5
6
7
7
There is no point of assigning i=i++ because both output will be same.
Hope you understand
22
prgram gave 19 9 as output
in first step i.e, b=(a++)+(a--)
b=(4)+(5)=9
after taking a++ as 4 its an post increment so for a-- we get 5
@@durgavarshith9596 how is a = 19 and not 20?
Bsdk galat hai
galat padhaane se acha plzz dont upload videos i tried solving,, method hi glat hai
18, 8 is correct answer