C Language Problem 1 | Sanfoundry | #Shorts

preview_player
Показать описание
#Shorts - C Programming Language Series - Problem 1

1. C Language Problems Shorts Playlist:

2. C Interview Question Videos Playlist:

3. Advanced C Programming Videos (English Playlist):

4. Advanced C Programming Videos (Hindi Playlist):

5. Advanced C Programming Tutorial Video Series:

6. C Interview Questions Video Series:

7. 1000 MCQs (Multiple Choice Questions) on C programming:

8. Ultimate C Programs Collection (with Data-Structures + Algorithms):

#CShorts #CProgrammingShorts #CProblemShorts #SanfoundryShorts
Рекомендации по теме
Комментарии
Автор

b=++a + a++ + --a
++a= 3+1=4
a++= 4+1=5 (but here a=4 because post increament first assign then increment)
--a= 5-1=4
b=4+4+4
b=12

ajinkyadeshmukh
Автор

Start with a = 3.
++a increments a before its value is used, so now a is 4.
a++ uses the current value of a (4) and then increments it, so now a is 5.
--a decrements a before its value is used, so now a becomes 4.
Now, put it all together: b = 4 + 4 + 4 = 12.

hasshamkhan-gmji
Автор

b is d
[Process completed (code 6) - press Enter]

ZareenFatima-go
Автор

The answer is 9.Bcz ++a=4 and a++=4 and at last + --a=1(this + in front of a is the reason for the decrement of 2 ).

abhi
Автор

Explanation is ++a = 4, a++ = 5, --a = 4 that is totally 13, hope everyone understands

CashHotel-xlih
Автор

On Online c compiler
Answer is 13
And on turbo c
Answer is 9
Depends upon compiler bits system.

shivampal
Автор

Using increment and drecrement function

ImRoshan-seby
Автор

Ans is 9 because pre increment mean first add and post increment means assign and then add
So b=++a+a+++--a
b=4+3+2
b=9

PrachiGajbhiye-fc
Автор

I'm a begineer and thing the answer is b=10,
Because
++a = 4, a++ = 4, --a = 2
B=4+4+2=10

cutiboys
Автор

Undefined behaviour (depends on compiler)

krjnbpp
Автор

In newer comp: (3+1) + (4+1) + (5-1) = 4 + 5 + 4 = 13 // in old : (3+1) + 4 + (4-1) = 4 + 4 + 3 = 11

Fine_Mouche
Автор

The variable a is initialized with a value of 3.
The expression ++a increments the value of a by 1, resulting in a being equal to 4.
The expression a++ uses the post-increment operator, so the value of a (4) is used in the expression, but then a is incremented to 5.
The expression - -a decrements the value of a by 1, resulting in a being equal to 4 again.

Hence, 4+5+4 = 13

asrafulfardin
Автор

12 or 9 depends on compiler mostly its 12 in most compilers

himankjeshwar
Автор

answer is 13
a=3
++a=4
a++=4(after next step it ill be 5)
and - -a=5-1=4
total answer is=4+5+4=13...

SyedUmar-ewtw
Автор

its totally depend on compiler Answer is not Define

learncode
Автор

First it will increase by one that I 3+1=4 and + then 4+1 =5next it will decrease that is 5-1=4 at last it will print 4

Nisar
Автор

In turbo C compiler answer would be 9 but in gcc compiler answer would be 12

uditjec
Автор

++a gives 4 now a=4 then a++ means 5 then a is still 4 because it is first assigned and then got increment so it's still 4 and now --a means 3 . So the answer is 4+5+3=12

kurakulasyamsundar
Автор

Return 0 kyu nhi type kya kya yhi error he or iska answer 13 he

sandeepsvlog
Автор

Correct answer is 12 which the clang compiler (version 14.0.6) returns. However, the gcc (version 12.2.0) returns 13. b = 4 + 4 + 4

-smokem