Modify Operators | C Technical Interview Questions and Answers | Mr. Srinivas

Поделиться
HTML-код
  • Опубликовано: 23 янв 2025

Комментарии • 131

  • @NareshIT
    @NareshIT  5 лет назад +8

    Please Comment, Subscribe and Click Bell🔔🔔🔔 Icon for More Updates. To learn software course from our experts please register here for online training: @t

    • @amilaliwaris
      @amilaliwaris 4 года назад +1

      Sir answer is 9 and 19

    • @SunitaSharma-sb7eg
      @SunitaSharma-sb7eg 2 года назад

      sir output on "vs code" and "code block" is 19 and 9 but "blue & black" on output is 18 and 8 . pls explain.....

    • @swapnilwagh3274
      @swapnilwagh3274 Год назад

      wrong answer

  • @mohammadsujon124
    @mohammadsujon124 4 года назад +29

    Sir, in first expression a = 4 and b = 9. And second expression a = 19 and b = 9.

  • @prajwalkm9767
    @prajwalkm9767 6 лет назад +50

    Sir you have gone wrong here. Answer for a = 19 and b = 9.

    • @rahuljathar9429
      @rahuljathar9429 5 лет назад +12

      Turbo c compiler ans is : 18,8
      gcc compiler ans is : 19,9
      output is depend on your compiler (software)

    • @VikramS411
      @VikramS411 5 лет назад +2

      right bro..

    • @mbeddedwindrobotics1726
      @mbeddedwindrobotics1726 5 лет назад +2

      @@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.

    • @jeneeshrobert2113
      @jeneeshrobert2113 4 года назад +2

      In turbo c++ 18 and 8

    • @clashingdrash1772
      @clashingdrash1772 3 года назад

      check with changing a-- by a no change occur

  • @rahuljathar9429
    @rahuljathar9429 5 лет назад +8

    Turbo c compiler ans is : 18,8
    gcc compiler ans is : 19,9
    output is depend on your compiler (software)

    • @Kumar12125
      @Kumar12125 4 года назад

      Thank u bro, you clarified my doubt

  • @harsh.m2897
    @harsh.m2897 Год назад +2

    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

  • @chitrasingh8724
    @chitrasingh8724 4 года назад +1

    Crystal clear concept 🙏

  • @utkarshparekh7675
    @utkarshparekh7675 5 лет назад +9

    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.....

    • @AmanGupta-ph5sd
      @AmanGupta-ph5sd 4 года назад

      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 ruclips.net/video/yRt-zYFJIvE/видео.html

  • @uddiptamondal9509
    @uddiptamondal9509 4 года назад +10

    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?

    • @atom7004
      @atom7004 3 года назад +2

      yes, the same case happening at my side too.

    • @duggirambabu7792
      @duggirambabu7792 2 года назад

      Which compiler do you use?

    • @duggirambabu7792
      @duggirambabu7792 2 года назад

      @@atom7004
      Which compiler do you use?

    • @diogo2381
      @diogo2381 Год назад

      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]|

  • @itsheaven5701
    @itsheaven5701 6 лет назад

    That's the only place where I learnt a lot.... Tysm sir

  • @manasatadigadapa4952
    @manasatadigadapa4952 3 года назад

    Superb sir 🙏🙏

  • @sujithgoud3535
    @sujithgoud3535 4 года назад +1

    Thank u 🙏 sir..!?

  • @gnanaswty
    @gnanaswty 5 лет назад

    I got result as same result of you nice one tq

  • @chandangiri777
    @chandangiri777 6 лет назад

    Thanks sir you are fabolous fantastic stunning

  • @singamhariharan7459
    @singamhariharan7459 Год назад +4

    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

  • @tapanjeetroy8266
    @tapanjeetroy8266 6 лет назад

    thanks a lot sir...

  • @anjanamanoj9186
    @anjanamanoj9186 6 лет назад

    Thankyou sir

  • @vasudevans8011
    @vasudevans8011 3 года назад +2

    I compiled it also in Dev C Apllication..
    Output is. " 19 9".
    Guys make sure it

  • @mohit8363
    @mohit8363 3 месяца назад +2

    99.9% user wrong answer in this comment and also teacher also wrong and 0.1% user corect answer is 20,9

  • @Adityaarockss
    @Adityaarockss 7 лет назад

    Thank you

  • @sujathasivakumar6422
    @sujathasivakumar6422 5 лет назад

    super sir.

  • @goutamdam8546
    @goutamdam8546 3 года назад

    Sir please discuss more equation with the combination of both increment and decrement operator on the same line of equation

  • @commandermsv3329
    @commandermsv3329 4 года назад +3

    i=4;
    j= ++i*i++;
    i calculated by your method j=25 but compiler giving j=30.
    help!!!!

  • @devashishchoubey1965
    @devashishchoubey1965 6 лет назад

    thnx .

  • @murgan4307
    @murgan4307 2 года назад +1

    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)

  • @shaikmaksood8774
    @shaikmaksood8774 5 лет назад +3

    Sir its wrong actually ans is a=19,b=9

  • @praveennaik3679
    @praveennaik3679 4 года назад

    main()
    {
    int z, x=5, y=-10, a=4, b=2;
    z=x++ - --y * --b / a;
    printf("%d ",z);
    }
    Output will be 7, how?

  • @nagendramishra100
    @nagendramishra100 6 лет назад +8

    this method is wrong for solving expression

    • @akshaymdeshmukh764
      @akshaymdeshmukh764 4 года назад

      Please tell me Right Ans. Process

    • @saitejateegala2986
      @saitejateegala2986 4 года назад

      @@akshaymdeshmukh764 refer codechamp channel bro you will get

    • @akshaymdeshmukh764
      @akshaymdeshmukh764 4 года назад +1

      @@saitejateegala2986 I got it from codechamp somedays before. Thank you Sai...

  • @duggirambabu7792
    @duggirambabu7792 2 года назад

    According to Turbo C++ Version 3.0,
    Output: a = 18, b = 8

  • @ParnikaTutorials
    @ParnikaTutorials 4 года назад +1

    a value is 19, b is 9

  • @ganapakaakash415
    @ganapakaakash415 4 года назад +1

    It depends on compiler

  • @josephdaniel6703
    @josephdaniel6703 7 лет назад +3

    Hi op comes 19 9 please upload again

  • @Gameplay-pq6hk
    @Gameplay-pq6hk 7 лет назад +2

    Sir please verify , Is this right ?
    I wrote the same code and got O/P 20 and 9

  • @shivakuchana4713
    @shivakuchana4713 6 лет назад +2

    Hi Sir. Can you explain how it will print 5 here.
    V1=2, V2;
    V2=V1++ + V1++;
    printf("%d", v2) ;

    • @slobodantajisic2762
      @slobodantajisic2762 6 лет назад +3

      1. step) left v1++ = 2, v1 = 3
      2. step) right v1++ = 3, v1 = 4
      3. step) v2 = v1++ + v1++ = 2 + 3 = 5, v1 = 4

    • @rutukeshkashid5058
      @rutukeshkashid5058 Год назад

      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

  • @gopaltiwari9402
    @gopaltiwari9402 4 года назад +3

    Wrong,final value should be a=19 & b=9

    • @mohit8363
      @mohit8363 3 месяца назад

      You are also wrong

  • @lakshmibmaddasani3937
    @lakshmibmaddasani3937 5 лет назад +3

    He is completly wrong
    Its output is a=20; b=9; i executed in jdk

  • @shifasultana9926
    @shifasultana9926 7 лет назад

    #include
    int main()
    {
    int i = 1;
    printf("%d %d %d
    ", i++, i++, i);
    return 0;
    }
    sir wat is d output of this

    • @shaikrabbani2954
      @shaikrabbani2954 7 лет назад +1

      2,1,3

    • @mohitbv2331
      @mohitbv2331 7 лет назад

      could you please explain?

    • @seelammadhusagar4176
      @seelammadhusagar4176 7 лет назад +1

      Shifa Sultana 1,2,3

    • @arnabsom3251
      @arnabsom3251 7 лет назад

      211

    • @babumandal5646
      @babumandal5646 7 лет назад +1

      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/

  • @priyadilsha1162
    @priyadilsha1162 7 лет назад +5

    Hi Sir,
    I wrote this program in C and it gave me a result of 19, 9. Can anyone explain?
    Thanks

    • @tanyaplovesmusic
      @tanyaplovesmusic 7 лет назад +1

      same

    • @babumandal5646
      @babumandal5646 7 лет назад

      It depend on compiler....

    • @mdnizamraza7939
      @mdnizamraza7939 6 лет назад +4

      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

    • @deepjyotide3223
      @deepjyotide3223 6 лет назад +1

      @@mdnizamraza7939 a comes out to be 20

    • @laljiniranjan3276
      @laljiniranjan3276 6 лет назад

      I think correct answer is a=11 and b=9....

  • @vaibhavambekar7427
    @vaibhavambekar7427 5 лет назад

    Ans is wrong ,it is 19,9 in both 32 bit and 64 bit compiler

  • @shaik3172
    @shaik3172 3 года назад

    dammn my compiler is showing a =19 and b = 9 ; am i wrong dude?

  • @Andrew_EvsW
    @Andrew_EvsW 7 лет назад

    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 :) !

    • @arnabsom3251
      @arnabsom3251 7 лет назад

      its because of the compiler different compiler gives different lexical values based on the tokens generated by the threads

    • @lawn_mower4941
      @lawn_mower4941 6 лет назад +2

      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

    • @AmanGupta-ph5sd
      @AmanGupta-ph5sd 4 года назад

      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 ruclips.net/video/yRt-zYFJIvE/видео.html

    • @murgan4307
      @murgan4307 2 года назад +1

      @@lawn_mower4941
      this is ok all discusion

  • @Reddy7877
    @Reddy7877 2 года назад

    Hi sir,
    Can you please Execute and let me know the answer

  • @rising_legends1771
    @rising_legends1771 2 года назад +1

    sir ,answer is wrong!

  • @jagginadivya3680
    @jagginadivya3680 6 лет назад +2

    answer is 19 and 9 sir u went wrong

    • @rahuljathar9429
      @rahuljathar9429 5 лет назад

      Turbo c compiler ans is : 18,8
      gcc compiler ans is : 19,9
      output is depend on your compiler (software)

  • @technicalsam6633
    @technicalsam6633 5 лет назад +3

    i got the answer 19,9

  • @amilaliwaris
    @amilaliwaris 4 года назад

    Sir answer is 9 and 19

  • @rajpra7993
    @rajpra7993 4 года назад +1

    Solving with right method, we get 20,9 answer

    • @mohammadsujon124
      @mohammadsujon124 4 года назад +2

      Brother, according to mingw and gcc compiler a = 19 b = 9.

    • @jishandas6559
      @jishandas6559 3 года назад

      Solving with right method, the answer is 19,9

    • @singamhariharan7459
      @singamhariharan7459 Год назад

      No follow the concept of increment operators and do it properly, u will get output as 20,9

  • @amitkumarmahapatra4829
    @amitkumarmahapatra4829 5 лет назад

    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

    • @parekhhimanshu9641
      @parekhhimanshu9641 5 лет назад

      Try by storing i++ in another variable then there will be change

    • @revanthsaiesh67
      @revanthsaiesh67 5 лет назад +1

      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

  • @duggirambabu7792
    @duggirambabu7792 3 года назад +1

    *Output:* 20, 9

    • @murgan4307
      @murgan4307 2 года назад

      19,9

    • @murgan4307
      @murgan4307 2 года назад

      Turbo c
      compiler ans is : 18,8
      gcc compiler ans is : 19,9
      output is depend on your compiler (software)

    • @singamhariharan7459
      @singamhariharan7459 Год назад +1

      ​@@murgan4307bro don't follow the compiler, follow the concept of increment operators and do it properly, u will get the output as 20,9

    • @mohit8363
      @mohit8363 3 месяца назад

      99.9% user wrong answer in this comment and also teacher also wrong and 0.1% user corect answer is 20,9

  • @narasareddymule1728
    @narasareddymule1728 5 лет назад +2

    Video visual clarity ledu ra

  • @kiranbs5057
    @kiranbs5057 5 лет назад +1

    Answer is wrong !! ...wrong explanation

  • @medhasaha817
    @medhasaha817 4 года назад +1

    Output is 20 and 9.

  • @kumarkumar8067
    @kumarkumar8067 Год назад

    Sir u have done wrong please cross check once

  • @MrANANDARAJA
    @MrANANDARAJA 5 лет назад

    19 , 9 only boss

  • @Hasini_ananthula
    @Hasini_ananthula Год назад

    Anna b=9

  • @amar-eu7cw
    @amar-eu7cw 4 года назад

    Why answer becomes 19 9 why +1

  • @ravulamanjula4397
    @ravulamanjula4397 5 лет назад +2

    The answer must be 9,20 .

  • @addagallanaresh8334
    @addagallanaresh8334 2 года назад +1

    Output is 19,9 , i will give better explanation then you

    • @mohit8363
      @mohit8363 3 месяца назад +1

      You are also wrong right answer is 20,9 and first you understand operator concept rule

  • @devbisht1819
    @devbisht1819 6 лет назад +1

    galat padhaane se acha plzz dont upload videos i tried solving,, method hi glat hai

  • @hatredknight9964
    @hatredknight9964 5 лет назад +1

    Listen all java is better than c

    • @softwarefoodiee
      @softwarefoodiee 4 года назад

      And you listen python is better than java

    • @hatredknight9964
      @hatredknight9964 4 года назад +1

      @@softwarefoodiee na not yet listened 😒

  • @pokigamerop
    @pokigamerop 3 года назад

    22

  • @slfactvideo298
    @slfactvideo298 Год назад

    Hindi me translation

  • @shubhamsharma4113
    @shubhamsharma4113 4 года назад

    Bsdk galat hai

  • @meghasyam427
    @meghasyam427 7 лет назад

    prgram gave 19 9 as output

    • @durgavarshith9596
      @durgavarshith9596 7 лет назад +2

      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

    • @deepjyotide3223
      @deepjyotide3223 6 лет назад +3

      @@durgavarshith9596 how is a = 19 and not 20?

  • @Anishkumar-bj1sp
    @Anishkumar-bj1sp 6 лет назад +1

    18, 8 is correct answer