Notes for You:: Assignment Operators in C.
Assignment Operator: =
- is used to assign a value to variable or a constant.
Short Hand Assignment (SHA) Operators:
- allow us to write condensed or compact form assignment statements.
+=, -=, *=, /=, %=
Example code:
#include <stdio.h>
int main()
{
const float PI = 3.142;
printf("%f\n",PI);
int a = 0;
printf("%d\n",a); // 0
a = 10;
printf("%d\n",a); // 10
a += 10; // a = a + 10;
printf("%d\n",a); // 20
a -= 10; // a = a - 10;
printf("%d\n",a); // 10
a *= 2; // a = a * 2
printf("%d\n",a); // 20
a /= 2; // a = a / 2
printf("%d\n",a); // 10
a %= 2; // a = a % 2
printf("%d\n",a); // 0
a += 10; // a = a + 10;
printf("%d\n",a); // 10
return 0;
}
Note:
- replace < with less-than symbol.
- replace > with greater-than symbol.
=========================================
Follow the link for next video:
C Programming Tutorial 27 - Increment and Decrement Operators in C - Part 1
[ Ссылка ]
Follow the link for previous video:
C Programming Tutorial 25 - Logical Operators in C Programming Language
[ Ссылка ]
=========================================
C Programming Tutorials Playlist:
- [ Ссылка ]
=========================================
Watch My Other Useful Tutorials:-
Computer Programming Fundamentals Playlist:-
[ Ссылка ]_
C Practical LAB Exercises Playlist:-
[ Ссылка ]
C++ Tutorials Playlist:
[ Ссылка ]
=========================================
► Subscribe to our YouTube channel:
[ Ссылка ]
► Visit our Website:
[ Ссылка ]
=========================================
Hash Tags:-
#ChidresTechTutorials #CProgramming #CProgrammingTutorial
![](https://i.ytimg.com/vi/tj9yKqbUeuI/maxresdefault.jpg)