हिंदी माध्यम नोट्स
Categories: C Language in hindi
Operator Precedence or Math Library in hindi , OPERATOR PRECEDENCE , OPERATOR ASSOCIATIVE
जैसे के हमने पिछले article मे , operator के प्रकार और उससे संबधित advance methodology को पढ़ा |लेकिन सबसे महत्वपूर्ण topics तो अभी भी बाकि था |वो है operator precedence |
Operator Precedence :
किसी expression मे used दो या दो से अधिक operators को c complier किस क्रम मे solve करेगा| ये used operator की precedence पर निर्भर करता है |c language मे अलग अलग level होते है सभी operator किसी ना किसी level का भाग होते है |
higher level के operator सबसे पहले solve होते है |
जैसे function call और array element का level 1 है वो किसी भी expression मे सबसे पहले solve होते है |
Operator Associative :
किसी expression मे operator को left से right या right से left solve करने का decision operator associative property करता है |सभी operators या तो left तो right या right तो left associative property को follow करते है |
सभी operators की precedence और associative property निम्न है :
level 1:
इस level मे array declaration और function call आते है |ये सबसे पाहे solve होते है |इसका associative left तो right होता है |
level 2:
इस level मे 07 operators है | जिसमे sizeof ()operator, typecast, increment(++), decreament(–), not (!), address(&), pointer reference(*) है |in सभी associative right तो left है |
level 3:
इसमें multiplication(*), division(/) और modules (%) आते है |इसकी associative left तो right होती है |
level 4:
इसमें सिर्फ addition(+) और subtraction(-) आते है |इसकी associative left से right होती है |
level 5:
इसमें equality और inequality के अलावा सभी relation operators आते है |greater than(>),less than(<),greater than or equal to(>=) और less than or equal to(<=) आते है |इसकी associative left तो right होती है |
level 6:
इसमें equal(==) और not equal(!=) आते है | इसकी associative left से right होती है |
level 7 ,8 और 9:
ये तेनो level bitwise operators के लिए है | level 7= bitwise and (&) ,level 8=bitwise Xor(|) और level 9= bitwise OR के लिए है | इन सबकी associative left तो right होती है |
level 10,11:
ये तेनो level logical operators के लिए है | level 10= logical and (&&) ,level 11=logical OR (||) के लिए है | इन सबकी associative left तो right होती है |
level 12 :
ये level condition operator(? : 🙂 के लिए होती है | इसकी associative right तो left होती है
level 13:
इस level मे assignment operators (=)होता है|इसलिए expression solve होने के बाद ही आउटपुट variable मे assign होता है |इसकी associative भी right तो left होती है |
उदहारण के लिए :
#include<stdio.h>
#include<conio.h>
void main()
{
int a=12,b=33,c=4,d=5,w=44,g=6;
int output;
output = a+b*c/w-d*g;
printf(“Output=%d”,ouput);
getch ();
}
ओउटपुट होगा :
Output=-15
Math library :
Math library मे सभी trigometric और airthmatic कैलकुलेशन के सीधे functions store होते है |in function को used करने के लिए math .h header file को लिंक करना होता है |इसमें उपस्थित सभी functions की table निम्न है |
s.no | Syntax | description |
1. | Cosh(X) | Hyperbolic consine vale of variable ‘X’ |
2. | Sinh(X) | Hyperbolic sine value of variable ‘X’ |
3. | Tanh(X) | Hyperbolic tan value of variable ‘X’ |
4. | cos(X) | Consine value of variable ‘X’ |
6. | sin(X) | Sine value of variable ‘X’ |
7. | tan(X) | Tan value of variable ‘X’ |
8. | ceil(X) | X to truncate up to nearest integer |
9. | Exp(X) | Calculate ex |
10. | Fabs (X) | Absolute value of ‘X’ |
11. | Floor(X) | X truncate down to nearest integer |
12. | Fmod(X,Y) | Find Reminder X/Y |
13. | Log(X) | Find the value of natural logarithm of ‘X’ |
14. | Log10(X) | Find the value of base 10 logarithm of ‘X’ |
15. | Pow(x,y) | Find x to power of y |
16. | Sqrt(x) | Find square root of x |
Hyperbolic or Normal Trigonometric Functions :
इस category मे सभी hyperbolic Trigonometric और Normal Trigonometric function आते है|सारणी की पहली छ lines मे इनके syntax है |
उदहारण के लिए :
#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
int degree;
float output1,output2,output3;
printf(“Enter Your Degree”);
scanf(“%d”,°ree);
output1=cos(degree);
ouput2=sin(degree);
output3=tan(degree);
printf(“Cosine Value=%4f”,output1);
printf(“Sine Value=%4f”,output2);
printf(“Tan Value=%4f”,output3);
ghetch();
}
आउटपुट होगा :
Enter Your Degree45
Cosine Value=0.7071
Sine Value=0.7071
Tan Value=1
Ceil () or Floor () Function:
Ceil function का मुख्य उपयोग decimal value को nearest integer मे Truncate करने के लिए किया जाता है |इसमें upward Truncate होता है |
Floor function का उपयोग Ceil () function की तरह है किन्तु इसमें Downward Turncate होता है |
उदहारण:
#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
float a=2.25;
int b,c;
b=ceil(a);
c=floor(a);
printf(“Number after ceil function=%d”,b);
printf(“Number after floor function=%d”,c);
getch();
}
आउटपुट होगा :
Number after ceil function=3
Number after floor function=2
Arithmetic Function:
इसमें arithmetic function include होते है |जैसे log की value ,power कैलकुलेट करना आदि |इसकी सहायता से किसी arithmetic expression को सरल बनाया जा सकता है |
इसका उदहारण है :-
#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
int a;
int b=12,c=4;
a=pow (b,c);
printf(“value of %d power %d is %d.”,b,c,a);
getch();
}
आउटपुट होगा :
value of 12 power 4 is 20736.
Recent Posts
मालकाना का युद्ध malkhana ka yudh kab hua tha in hindi
malkhana ka yudh kab hua tha in hindi मालकाना का युद्ध ? मालकाना के युद्ध…
4 weeks ago
कान्हड़देव तथा अलाउद्दीन खिलजी के संबंधों पर प्रकाश डालिए
राणा रतन सिंह चित्तौड़ ( 1302 ई. - 1303 ) राजस्थान के इतिहास में गुहिलवंशी…
4 weeks ago
हम्मीर देव चौहान का इतिहास क्या है ? hammir dev chauhan history in hindi explained
hammir dev chauhan history in hindi explained हम्मीर देव चौहान का इतिहास क्या है ?…
4 weeks ago
तराइन का प्रथम युद्ध कब और किसके बीच हुआ द्वितीय युद्ध Tarain battle in hindi first and second
Tarain battle in hindi first and second तराइन का प्रथम युद्ध कब और किसके बीच…
4 weeks ago
चौहानों की उत्पत्ति कैसे हुई थी ? chahamana dynasty ki utpatti kahan se hui in hindi
chahamana dynasty ki utpatti kahan se hui in hindi चौहानों की उत्पत्ति कैसे हुई थी…
1 month ago
भारत पर पहला तुर्क आक्रमण किसने किया कब हुआ first turk invaders who attacked india in hindi
first turk invaders who attacked india in hindi भारत पर पहला तुर्क आक्रमण किसने किया…
1 month ago