Conditional Operator in C

แชร์
ฝัง
  • เผยแพร่เมื่อ 12 ส.ค. 2024
  • C Programming & Data Structures: Conditional Operator in C
    Topics discussed:
    1. Introduction to Conditional Operator in C language.
    2. Use of Conditional Operator.
    3. Example of Conditional Operator.
    4. Homework Problem.
    C Programming Lectures: goo.gl/7Eh2SS
    Follow Neso Academy on Instagram: @nesoacademy(bit.ly/2XP63OE)
    Follow me on Instagram: @jaspreetedu(bit.ly/2YX26E5)
    Contribute: www.nesoacademy.org/donate
    Memberships: bit.ly/2U7YSPI
    Books: www.nesoacademy.org/recommende...
    Website ► www.nesoacademy.org/
    Forum ► forum.nesoacademy.org/
    Facebook ► goo.gl/Nt0PmB
    Twitter ► / nesoacademy
    Music:
    Axol x Alex Skrindo - You [NCS Release]
    #CProgrammingByNeso #CProgramming #ConditionalOperator

ความคิดเห็น • 433

  • @ProgrammingwithArijit
    @ProgrammingwithArijit 4 ปีที่แล้ว +1356

    Ans will be 65.
    Explanation:
    lets break the problem into part
    (1) At first the condition is sizeof(var)
    if this condition is evaluated to be true then (var2>23 ? ((var==75) ? 'A' : 0) : 0) will be returned
    if false then 0 will be returned
    As we know sizeof() is an unary operator which returns how many byte a datatype can hold
    as var is an variable of integer data type , sizeof(var) will either return 2 or 4 as machine to machine int vary . We know every number except 0 is evaluated to be true. So (var2>23 ? ((var==75) ? 'A' : 0) : 0) it will returned
    (2)next the condition is (var2>23)
    if this condition is evaluated to be true then ((var==75) ? 'A' : 0) will be returned
    if false then 0 will be returned
    as we know 56>23 is true then ((var==75) ? 'A' : 0) will be returned.
    (3)the condition is (var==75)
    if this condition is evaluated to be true then 'A' will be returned
    if false then 0 will be returned
    As 75==75 then 'A' will be returned and stored into num variable
    As c support auto type casting so int can store char.
    In the final printf function we use the placeholder %d and it print integer value .
    According to Ascii integer value of 'A' is 65
    So the output will be 65.

    • @daytrade1013
      @daytrade1013 4 ปีที่แล้ว +10

      Thank you

    • @harshmk1052
      @harshmk1052 4 ปีที่แล้ว +8

      Thanks a lot :)

    • @mehadihasansanto538
      @mehadihasansanto538 4 ปีที่แล้ว +46

      Why don't you think that ((var==75)? 'A' : 0) will be evaluated first? [As we know that bracket has the highest precedence than any other operator in C.]

    • @ayushvats1808
      @ayushvats1808 4 ปีที่แล้ว +9

      @@mehadihasansanto538 xactly this is my doubt and i think bracket will only be evaluated first

    • @mehadihasansanto538
      @mehadihasansanto538 4 ปีที่แล้ว +13

      @@ayushvats1808 Yeah, Brother. I also think so. Moreover, the associativity of conditional operator(? :) works from right to left. That's why I think ((var == 75)? 'A' : 0) will be evaluated first.

  • @102ayushkumar3
    @102ayushkumar3 3 ปีที่แล้ว +13

    Answer -> 65
    Solution ->
    num = sizeof(var) ? (var2 > 23 ? ((var == 75) ? 'A' : 0) : 0) : 0;
    as we know, var==75 is True, therefore, (var == 75) ? 'A' : 0 will be equal to 'A'.
    Then we will replace the equation with 'A' in the main equation.
    num = sizeof(var) ? (var2 > 23 ? 'A' : 0) : 0;
    as we know, var2 == 56, hence greater than 23, therefore, var2 > 23 ? 'A' : 0 will be equal to 'A'.
    Then we will replace the equation with 'A' in the main equation.
    num = sizeof(var) ? 'A' : 0;
    as we know, as condition is True if the result of expression is any number except 0, sizeof(var) == 4, as its an integer data type.
    sizeof(var) is a True statement, therefore, sizeof(var) ? 'A' : 0 will be equal to 'A'.
    This implies num = 'A';
    In the printf statement, the format specifier of num is %d, so the ASCII value of the character will be printed. ASCII value of 'A' = 65.

    • @acoinhastwosides5239
      @acoinhastwosides5239 ปีที่แล้ว

      You make it understandable. You remove my confusion to explain it line by line. Thax

  • @randomthief7838
    @randomthief7838 4 ปีที่แล้ว +25

    Interesting lectures and also they are making to think for every homework questions.

  • @soumi6720
    @soumi6720 2 ปีที่แล้ว +3

    hands down this is the best channel . pls continue blessing us with valuable information.

  • @pranaylambat9743
    @pranaylambat9743 5 ปีที่แล้ว +137

    O/p is 65 ... because all three condition are true...sizeof(var)
    Shows the size of int (which is other than 0 ....and then after all condition are executed it will return A and the decimal of A is 65 ..
    according to ASCII TABLE

    • @Gautamsingh-dy4cp
      @Gautamsingh-dy4cp 4 ปีที่แล้ว +4

      But here parenthesis is given first evaluate parenthesis then applied conditional ..

    • @saiyadav5014
      @saiyadav5014 4 ปีที่แล้ว +1

      By evaluating with the parentheses the answer will be A.
      But in what manner computer will execute.?

    • @kajolnimesh483
      @kajolnimesh483 4 ปีที่แล้ว +2

      @@saiyadav5014 Answer should A for sure as all the conditions are true, but compiler should execute A as a integer value as it is assigned to num variable that is integer variable.

    • @sairakeshdurga600
      @sairakeshdurga600 4 ปีที่แล้ว

      tq bro

    • @udaykumar-es2el
      @udaykumar-es2el 2 ปีที่แล้ว

      @@Gautamsingh-dy4cp but as for associvity rule it caan be done from left to right

  • @shashankpandey6428
    @shashankpandey6428 4 ปีที่แล้ว +14

    Thanks a lot for videos sir ❣️. It's really helpful.

  • @rsingh6216
    @rsingh6216 3 ปีที่แล้ว +5

    This question is like 10 questions in one question. Neso team is great.

  • @millenmarbun24
    @millenmarbun24 5 ปีที่แล้ว +250

    it will be wayyy better if you can explain the homework problems @nesoacademy sometimes I can't fully comprehend the answers

  • @bengalisareeshubstore3633
    @bengalisareeshubstore3633 2 ปีที่แล้ว +2

    Result is 65, start to solve from the inner bracket to the outer bracket, fixed inputs and take care of format specifier used during output, it will convert the result A into ASCII decimal 65 (%d is used for output)

  • @justindenison7029
    @justindenison7029 4 ปีที่แล้ว +37

    Output will be the ASCI code of 'A' =65; Thank you for your efforts, I like your explanation so much ❤

  • @98_shubhamr.sharma78
    @98_shubhamr.sharma78 2 ปีที่แล้ว +16

    Sir please solve homework problems also so that we can give it a try and if we are not able to solve it then we can refer to your explanation that would really really be helpful for beginners like me and all would really appreciate that effort of yours!!!! 🙏🙏🙏🙏

  • @satishsgm0157
    @satishsgm0157 2 ปีที่แล้ว +9

    First rule to be followed while solving these type of conditions is:
    First of all we need to divide given expression into three parts i.e L|M|R
    And then start evaluate each and expression.
    Al last num variable initialised by A which is equivalent of 65.

  • @wajahatriazmirza
    @wajahatriazmirza 3 ปีที่แล้ว +7

    The answer is 65
    First we will solve the inner brackets. According to that our condition is true so it will store the corresponding value of A according to ASCII i.e. 65 (because we are dealing with integer datatype). Then we will work our way out solving the outer brackets one by one. Hence the final answer is 65.

  • @Dwarika_Sahu
    @Dwarika_Sahu 4 ปีที่แล้ว +1

    Thank you so much for this information

  • @helloHima790
    @helloHima790 3 ปีที่แล้ว +5

    65 since sizeof var is 4or 8 according to processor which is True in boolean form and ascii value of A is 65 as we need to print in integer the value.

  • @sajooj7948
    @sajooj7948 2 ปีที่แล้ว

    can you determine the size of on your own without using the sizeof() operator? is it like a rule where int is always 4? And do we start solving the expression from the parenthese on the inside or outside first?

  • @Xero75
    @Xero75 ปีที่แล้ว

    Great job kn explaining this! Thank you 😊 soo much

  • @jayap8355
    @jayap8355 3 ปีที่แล้ว +2

    O/p - ASCII Value of A= 65
    Explained it perfectly man!!!!

  • @sachinkumbar3789
    @sachinkumbar3789 4 ปีที่แล้ว +2

    It will print output as a 65
    which is ASCII equivalent of 'A'

  • @ahmedsedeek2814
    @ahmedsedeek2814 5 ปีที่แล้ว +68

    okay guys , here is the point ..
    if we considered it as an if statement , it'll be as following ; )
    int var = 75 , var2 = 65;
    int num ;
    if(sizeof(var))
    {
    if(var2 > 23)
    {
    if(var == 75)
    {
    num = 'A';
    }
    }
    printf("%d" , num);
    }
    else
    return 0;
    the output is gonna be 65 , and this is according to ASCII table , as 'A' is = 65 ..

    • @khalilrin-ju3nm
      @khalilrin-ju3nm 4 ปีที่แล้ว +3

      thank you very much for explanation Mr Sedeek. If you do not mind
      i will ask you questions in future too

    • @nbk330
      @nbk330 4 ปีที่แล้ว +4

      by looking at this equation now i understood the last stage of the problem clearly

    • @ekanshkhanulia4078
      @ekanshkhanulia4078 3 ปีที่แล้ว

      Please make your own videos,no gyan choding here

    • @Gaurav-zh4pm
      @Gaurav-zh4pm 3 ปีที่แล้ว

      else statements biro ?

    • @pavanroyal8183
      @pavanroyal8183 2 ปีที่แล้ว

      Var 2 is 56 .how u right 65?

  • @Gautamsingh-dy4cp
    @Gautamsingh-dy4cp 4 ปีที่แล้ว

    Sir firstly applied parenthesis operation after that apply ternary operator..first offl all remove parenthesis then evaluate ..it true or not

  • @Sekhar_Home
    @Sekhar_Home 3 ปีที่แล้ว

    Thnx . U have given me a best lecture

  • @ssenapati3328
    @ssenapati3328 4 ปีที่แล้ว +3

    Pls tell the ans with ur explain @neso academy.. All doute are clear

  • @akritibhan5858
    @akritibhan5858 3 ปีที่แล้ว

    questions are just amazing..

  • @pramodinireddy1553
    @pramodinireddy1553 3 ปีที่แล้ว +2

    Your classes are amazing sir , the way you explain with examples makes us more easier to understand the topics .

  • @abhijit2231
    @abhijit2231 4 ปีที่แล้ว +3

    Output will be ASCII value of 'A' ie. 65

  • @agamgill9563
    @agamgill9563 6 ปีที่แล้ว +3

    Numeric value of a return 65

  • @fahimarian2264
    @fahimarian2264 6 ปีที่แล้ว +8

    Output will be : 65

  • @neelabauri9503
    @neelabauri9503 2 ปีที่แล้ว

    do we have to memorise the ascii table values?

  • @AbbaJi-gm4vc
    @AbbaJi-gm4vc 4 ปีที่แล้ว +2

    Sir please give the solution video also so that we can compare our result

  • @porankirajkumar4709
    @porankirajkumar4709 ปีที่แล้ว

    As the variable num is of data type integer how can it take of char 'A' as its value and print 65 in integer

  • @ashishtayade047
    @ashishtayade047 9 หลายเดือนก่อน

    Thank you sir very nice gide & very nice best information conditional operator teaching video.👍

  • @aldaiansaklain8489
    @aldaiansaklain8489 หลายเดือนก่อน

    Really awesome classes.

  • @gautam1801
    @gautam1801 2 ปีที่แล้ว +30

    Thanks for teaching me something in 5 minutes that my teacher took two 50 minutes classes for! 😃😃

    • @kunalkhallar9699
      @kunalkhallar9699 10 หลายเดือนก่อน +1

      I think that's the main reason, why does our education system lag behind.

    • @sumit4789
      @sumit4789 9 หลายเดือนก่อน

      true uncle@@kunalkhallar9699

  • @deepeshsunuwar1086
    @deepeshsunuwar1086 4 ปีที่แล้ว +3

    all the three boolean returns true value so the value of num is "A" then the ASCII value of A is printed.
    so the final answer will be 65...........

  • @deepakbhardwaj3141
    @deepakbhardwaj3141 6 ปีที่แล้ว +2

    U r awesome

  • @TheGamer_Bhai
    @TheGamer_Bhai 3 ปีที่แล้ว

    Whole expression is true that's by it has to return 65(at the place of A because c supports auto casting).

  • @angurujogarao2313
    @angurujogarao2313 4 ปีที่แล้ว

    Both conditions are satisfied and print A value or A

  • @cirobermudez
    @cirobermudez 6 ปีที่แล้ว +3

    The output of the programa is A, because as sizeof(var) is diferent to 0 it enters to the first true statement, then it checks if var2 > 23, that is true, so finally checks it var == 75, again this is true so num equal to A

    • @cirobermudez
      @cirobermudez 6 ปีที่แล้ว

      Lakshman Patel, thanks

    • @ankurdutta5641
      @ankurdutta5641 4 ปีที่แล้ว

      @@lakshmanpatelofficial but why is 65 ?

  • @waterford7736
    @waterford7736 2 ปีที่แล้ว

    Excellent👍

  • @raiyyanshaikh8164
    @raiyyanshaikh8164 ปีที่แล้ว

    Thank you so much

  • @sonusambharwal8828
    @sonusambharwal8828 4 ปีที่แล้ว +1

    Super sir

  • @kaynatshaikh7258
    @kaynatshaikh7258 3 ปีที่แล้ว

    thank you so much sir

  • @JackVaileon
    @JackVaileon 6 หลายเดือนก่อน

    I wonder if we can solve not from inner bracket but from the outer bracket, in this HW, both conditions are the same.

  • @sumanroy4615
    @sumanroy4615 4 ปีที่แล้ว +2

    Ans will be 65
    because the return value of 'num' is equal to 'A'
    according to ASCII table the value of A is 65.

  • @jay76
    @jay76 3 ปีที่แล้ว +1

    Out put will be 65
    Since program execution begins from main function
    Declared variable var and assigned 75 to it
    Declared another variable var2 and assigned 56 to it
    Declared num integer type
    And given condition sizeof is unary operator since given sizeof(int) it returns 2 or 4 bytes depends on the compiler machine.How many bytes int will occupy it returns
    We know that if the condition is false it returns 0 and other than 0 returns 1 so now our condition is true it checks other condition of that true it checks other condition finally it returns A and num is assigned with A and it will be printed since the value of A according to ASCII in c is 65

  • @vinaykumarreddy9956
    @vinaykumarreddy9956 3 ปีที่แล้ว

    using return in ternary operator is allowed?

  • @user-kr5tp1ls3d
    @user-kr5tp1ls3d 6 หลายเดือนก่อน

    5:22 o/p is 65
    thanks a bunch to the tutor n nesoAcademy ❤🙏

  • @true4189
    @true4189 3 ปีที่แล้ว

    Thank u

  • @anwarsayed6962
    @anwarsayed6962 2 ปีที่แล้ว

    Thanks

  • @ritiksaxenaofficial
    @ritiksaxenaofficial 5 ปีที่แล้ว +2

    Output is 65...ascii of A

  • @the_mitwa
    @the_mitwa ปีที่แล้ว

    Which ternary operator gets evaluated first?

  • @user-bu8mg7uq3s
    @user-bu8mg7uq3s 3 ปีที่แล้ว

    thank u

  • @yassineabbou5163
    @yassineabbou5163 ปีที่แล้ว

    thnak you

  • @randomthief7838
    @randomthief7838 4 ปีที่แล้ว +1

    65 stand for character A
    All the conditions are true.

  • @mechguy0404
    @mechguy0404 3 ปีที่แล้ว

    the answer will be 65, the ASCII value of 'A'. As each of the three statements is true so expression 2 of each statement will be the outcome.

  • @otetumooluwaseun3948
    @otetumooluwaseun3948 7 หลายเดือนก่อน

    All other inner conditional expressions will be treated first. They return true. Then, the main operand, sizeof, returns true which implies 'A' will be returned.
    Since %d specifier was used, the printf will print the decimal value of character A, which is 65.

  • @redactedboii1841
    @redactedboii1841 2 ปีที่แล้ว

    thnx man

  • @aniketnandi7478
    @aniketnandi7478 6 ปีที่แล้ว +4

    */Output will be*/
    65
    as per the expression, the result will be 'A' and it will be stored in num. But, num is int type data So, 'A' will be converted to its corresponding ASCII value which is 65.

  • @agamgill9563
    @agamgill9563 6 ปีที่แล้ว

    Good

  • @goutamvohra3442
    @goutamvohra3442 4 ปีที่แล้ว

    Ans is A but the return value is in the form of int datatype then it will transform into ASCII format return the value of A is 65
    So the output is 65

  • @unaib7676
    @unaib7676 4 ปีที่แล้ว +1

    65 because all conditions are true hence variable contain A and in decimal it will be 65

  • @rsingh6216
    @rsingh6216 3 ปีที่แล้ว

    I solved in first attempt , before this playlist ,i used to write stdio.h to studio.h

  • @selvalakshmis.v4232
    @selvalakshmis.v4232 3 ปีที่แล้ว

    65. Thank you, Sir

  • @Kim_jong_un69
    @Kim_jong_un69 ปีที่แล้ว

    Will print 65 because 65 is the ASCII value of A if you use print("%c", num); instead of %d you will get A.

  • @aniketzende753
    @aniketzende753 2 ปีที่แล้ว

    Could any one tell me why we can't convert char to short data type?.. in typecasting..

  • @urmilashukla9632
    @urmilashukla9632 7 หลายเดือนก่อน

    How it will contain 1 in conditional operators

  • @brocklesnarufcchamp1
    @brocklesnarufcchamp1 3 ปีที่แล้ว

    I didn't get the bracketing arrangement of this program. Why for sizeof(var) there is no enclosing bracket, and for (var2>23 there's only one bracket on the left and missing on the right, while ((var==75) has an enclosed bracket but has also an additional bracket on the left side. And when I change the bracketing in any way, I immediately receive a compiler error. Would someone please explain the bracketing arrangement of this program? I think it is very important that I know. Thank you in advance if you do answer my doubt.

    • @nwekedarlington8780
      @nwekedarlington8780 ปีที่แล้ว

      Use if else statement and see why all bracket shouldn't be closed b4 the other..

  • @brotherinterest6912
    @brotherinterest6912 ปีที่แล้ว

    so as i think that we have break it inside the bracket
    (var==75)?'A':0 then the answer is A because 75 is equal to 75.
    then,
    (var2>23?'A':0) then the answer will be A because 56 is greater than 23.
    then,
    we have sizeof(var)?'A':0; then the ascii A will be implemented that is 65

  • @nemo4049
    @nemo4049 5 ปีที่แล้ว

    Ascii value of A 65

  • @NMAJJINEERAJA
    @NMAJJINEERAJA 3 ปีที่แล้ว +4

    ASCII code of 'A' will be the answer and that is 65

  • @tufanchakraborty5925
    @tufanchakraborty5925 4 ปีที่แล้ว +6

    65
    Tip: use different bracket such as {}()

  • @venkat230
    @venkat230 4 ปีที่แล้ว

    Single quotations are responsible for printing ASCII value of A

  • @AsteriskYoutube
    @AsteriskYoutube 3 ปีที่แล้ว +3

    Sir I’m studying only 10th standard but learning c from u thanks a lot sir and I got the answer for ur homework problem as 0 if wrong plz explain by replying to me

    • @ravindra_sings_
      @ravindra_sings_ 3 ปีที่แล้ว

      ans is 65

    • @ravindra_sings_
      @ravindra_sings_ 3 ปีที่แล้ว +1

      Ans will be 65.
      Explanation:
      lets break the problem into part
      (1) At first the condition is sizeof(var)
      if this condition is evaluated to be true then (var2>23 ? ((var==75) ? 'A' : 0) : 0) will be returned
      if false then 0 will be returned
      As we know sizeof() is an unary operator which returns how many byte a datatype can hold
      as var is an variable of integer data type , sizeof(var) will either return 2 or 4 as machine to machine int vary . We know every number except 0 is evaluated to be true. So (var2>23 ? ((var==75) ? 'A' : 0) : 0) it will returned
      (2)next the condition is (var2>23)
      if this condition is evaluated to be true then ((var==75) ? 'A' : 0) will be returned
      if false then 0 will be returned
      as we know 56>23 is true then ((var==75) ? 'A' : 0) will be returned.
      (3)the condition is (var==75)
      if this condition is evaluated to be true then 'A' will be returned
      if false then 0 will be returned
      As 75==75 then 'A' will be returned and stored into num variable
      As c support auto type casting so int can store char.
      In the final printf function we use the placeholder %d and it print integer value .
      According to Ascii integer value of 'A' is 65
      So the output will be 65.Ans will be 65.

  • @xiaoshan9722
    @xiaoshan9722 3 ปีที่แล้ว

    the num = A ,but the output should be decimal number, then it convert to its binary representation 65

  • @veereshg2959
    @veereshg2959 3 ปีที่แล้ว

    when i changed var==45 it is false so it is giving output as 32764 can anyone please explain why 32764

  • @heyrishabh13
    @heyrishabh13 5 ปีที่แล้ว +2

    ASCII value of 'A' may be the answer.

  • @vikhansrujana4401
    @vikhansrujana4401 ปีที่แล้ว

    Please upload console i/o functions

  • @hikmathasanov
    @hikmathasanov 3 ปีที่แล้ว

    65 will be printed, since it is the decimal value of character A.

  • @saeedakther7023
    @saeedakther7023 2 ปีที่แล้ว +1

    Please explain again condition operation

  • @wobst6413
    @wobst6413 6 ปีที่แล้ว

    computer science 12tn lesson wise video in Tamil explain pls I am waiting

  • @reginahshikanda6478
    @reginahshikanda6478 ปีที่แล้ว

    Answer is 65 , thank you so much for this lectures

  • @khushiagarwal1995
    @khushiagarwal1995 6 ปีที่แล้ว +1

    Output: 65

  • @shreyaesha001
    @shreyaesha001 4 ปีที่แล้ว +3

    💐💛

  • @AbhinavKumar-qv7to
    @AbhinavKumar-qv7to ปีที่แล้ว

    65 ans because 'A' will be stored in num and due to %d it will be printed in ascii encoding equivalent 65.

  • @abdallashow
    @abdallashow 5 ปีที่แล้ว +1

    Thanks Sir

  • @deepakprasad6753
    @deepakprasad6753 4 ปีที่แล้ว

    ASCII value of may be 10 also and 65 too. so why even after that 65 will be output

    • @MrSaipranith
      @MrSaipranith 4 ปีที่แล้ว

      ASCII 1-31 are not assigned to anything. I presume you got confused by first image search result of Google. There the character assigned to 10 is empty. But what you have seen is just a representation of 10 in hex code.

  • @adityajayswal1303
    @adityajayswal1303 2 ปีที่แล้ว

    65 or wot blissed lectures.....

  • @harshantbaraiya4712
    @harshantbaraiya4712 10 หลายเดือนก่อน

    int var = 75; declares and initializes an integer variable var with the value 75.
    int var2 = 56; declares and initializes another integer variable var2 with the value 56.
    int num; declares an integer variable num without initializing it.
    Now, let's analyze the following line:
    num = sizeof(var) ? (var2 > 23 ? ((var == 75) ? 'A' : 0) : 0) : 0;
    This line uses nested conditional operators to assign a value to num based on several conditions:
    sizeof(var) calculates the size of the var variable, which is 4 bytes (assuming a typical 32-bit system).
    var2 > 23 checks if var2 is greater than 23, which is true because var2 is 56.
    (var == 75) ? 'A' : 0 checks if var is equal to 75. If it is, it assigns the character 'A' to num; otherwise, it assigns 0.
    So, the value of num will be 'A' because both sizeof(var) and var2 > 23 are true, and var is indeed equal to 75.
    Finally, the code prints the value of num using printf, which will output 'A' as a character (ASCII value of 'A' is 65).
    Therefore, the output of this code will be:
    A

  • @Tejaswini01212
    @Tejaswini01212 ปีที่แล้ว +1

    Ans of H.W:It will print 65 that means the o/p of code is 'A'
    65 is a ASCII value of capital 'A'.

  • @mislead1070
    @mislead1070 2 ปีที่แล้ว +1

    The ans is 65 i.e. Numerical equivalent of the letter A.
    Explaination:
    The first condition/expression will return the size of var which is ofcourse more than 0, and as we all know, any value other than 0 is said to be true, so hence, the next expression will get terminated, which is again true...
    Bec var2 i.e. 56 > 23, thus the next expression will get terminated which i again true as we can see the value of var is 75,
    So thus,
    being true it will again terminate the true statement,
    But this time, there is no condition and its just a letter 'A',
    So as it being the last one of the conditions, the 'A' will get stored in num
    And as we know,
    ("%d") prints numerical values, so even if we store alphabetical values, it will convert the alphabetical value to its Numerical equivalent according to the ASCII Table and thus we will be getting the output as 'A' i.e. 65.

  • @balaagisp8490
    @balaagisp8490 3 ปีที่แล้ว

    Ans is A because all 3 statement is true and if true the ans is A.
    But in printf it's %d which is integer and value of A is 65 in decimal so
    Final ans = 65

  • @abdulrubbinmohsin6111
    @abdulrubbinmohsin6111 4 ปีที่แล้ว

    ASCII value of A=65

  • @duconsao3768
    @duconsao3768 2 ปีที่แล้ว

    what is the definition of tenary operator 3:28

  • @ITVishal
    @ITVishal 3 ปีที่แล้ว +1

    Ofcourse

  • @yassineabbou5163
    @yassineabbou5163 ปีที่แล้ว

    i did not understand the first fact (the only ternary operator) can you help me please

  • @AbdElrahmanAmirMohamed
    @AbdElrahmanAmirMohamed 3 ปีที่แล้ว

    answer = 65 .... this is the decimal number parallel to "A" in ascii table.

  • @andistheinforitbutso7513
    @andistheinforitbutso7513 2 ปีที่แล้ว

    Good morning 🙏 🌄

  • @gauravjoshi4865
    @gauravjoshi4865 3 ปีที่แล้ว +3

    65 ASCII code of "A"

  • @AYUSHSINGH-pv3pl
    @AYUSHSINGH-pv3pl 2 ปีที่แล้ว +1

    #solution
    #include
    int main()
    {
    int var=75,var2=56,num;
    num=sizeof(var)?(var>23? ((var==75)?'A':0):0):0;
    printf(" the num is :%d",num);
    return 0;
    }
    output=65