JOIN us on
WhatsApp Group Join Now
Telegram Join Join Now

हिंदी माध्यम नोट्स

Class 6

Hindi social science science maths English

Class 7

Hindi social science science maths English

Class 8

Hindi social science science maths English

Class 9

Hindi social science science Maths English

Class 10

Hindi Social science science Maths English

Class 11

Hindi sociology physics physical education maths english economics geography History

chemistry business studies biology accountancy political science

Class 12

Hindi physics physical education maths english economics

chemistry business studies biology accountancy Political science History sociology

Home science Geography

English medium Notes

Class 6

Hindi social science science maths English

Class 7

Hindi social science science maths English

Class 8

Hindi social science science maths English

Class 9

Hindi social science science Maths English

Class 10

Hindi Social science science Maths English

Class 11

Hindi physics physical education maths entrepreneurship english economics

chemistry business studies biology accountancy

Class 12

Hindi physics physical education maths entrepreneurship english economics

chemistry business studies biology accountancy

Categories: C Language in hindi

C99 – Advance Function (Part-1) , in c language in hindi , abort() , exit() , quick exit() , EXIT_ SUCCESS

abort() , exit() , quick exit() , EXIT_ SUCCESS , C99 – Advance Function (Part-1) , in c language in hindi :-
c 99 मे हमने कई सारे मॉडिफिकेशन को पढ़ा जैसे नये data type , array और function के declartion मे changes ,header files |लेकिन इस सभी मॉडिफिकेशन के बाद C99 मे  special function को introduce किया गया है | जिससे प्रोग्राम को running control easy किया जा सकता है |
ये function है :
1. abort()
इस function का use प्रोग्राम को सुद्देंली termination के लिए किया जाता है |जब hadler को SIGBRT को assign कर सकते और इस command को signal मे pass करता है तब इस function का use किया जाता है |
इस function का use file को open और क्लोज करने के लिए किया जाता है |जब कोई file open और क्लोज होने command को denie कर देती है तब ये function perform हो सकता है |
इस function मे कोई भी argumnet pass नहीं होता है और कोई भी value return नहीं होती है |
इसका उदाहरण है :
#include<stdio.h>
#include<conio.h>
void main()
{
FILE *f;
f=fopen(“Data.doc”,”w”);
if(f==NULL)
{
printf(“File can not open .”);
abort();
}
else
{
puts(e);
}
fclose(f);
getch();
}
इस उदाहरण मे , file ‘Data.doc’ को open किया जाता है|अगर file उपलब्ध नहीं होती है तब file pointer ‘f’ की value NULL होती है |और  File can not open . message होता है इसके साथ abort() function से प्रोग्राम terminate हो जाता है |
आउटपुट होगा :
File can not open .
2. exit()
इस function का use प्रोग्राम को sudden termination के लिए किया जाता है |लेकिन इसमें प्रोग्राम के termination के साथ कई और clean up प्रोसेस perform होते है :
1.जिस function को exit() मे pass कियुआ जाता है use reverse order मे call किया जाता है |
2.सभी c streams क्लोज हो जाती है |
3.सभी temperory file भी क्लोज हो जाती है |
4.program का control environment पर आ जाता है |
अगर exit() function मे ‘0’ को pass किया जाता है तब प्रोग्राम के successful execution को define किया जाता है और इसके अलावा ‘1’ ,प्रोग्राम के unsuccessful execution को define करता है |
इस function मे exit_code को pass किया जाता है exit_code प्रोग्राम के execution  status को देफिंस करता है | कोईभी value return नहीं होती है |
इसका उदहारण है :
इसका उदाहरण है :
#include<stdio.h>
#include<conio.h>
void main()
{
FILE *f;
f=fopen(“Data.doc”,”w”);
if(f==NULL)
{
printf(“File can not open .”);
exit(1);
}
else
{
puts(e);
}
fclose(f);
getch();
}
इस उदाहरण मे , file ‘Data.doc’ को open किया जाता है|अगर file उपलब्ध नहीं होती है तब file pointer ‘f’ की value NULL होती है |और  File can not open . message होता है इसके साथ exit() function से प्रोग्राम terminate हो जाता है |और exit code ‘1’ , प्रोग्राम के unsuccessful एक्षेकुतिओन को define करता है |
function quick_exit() से associate होता है क्योकि जब प्रोग्राम मे exit () function को call किया जाता है तब कोम्प्लिएर मे exit() और quick exit() function मे confusion हो जाता है |
3. quick exit()
इस function का use , किसी प्रोग्राम के sudden termination के लिए किया जाता है लेकिन इसमें clean up process नहीं होता है |और quick exit को reverse order मे call किया जाता है |इसका मतलब है जो quick exit call सबसे बस मे होगे वो सबसे पहले execute होगा |
इसका उदाहरण है :-
#include<stdio.h>
#include<conio.h>
void add(int ,int );
void  sub (int int);
void main()
{
int a ,b ;
printf(“enter data  “);
scanf(“%d %d “, &a &b);
quick_exit(add(a ,b));
quick_exit(sub(a ,b));
getch();
}
void add(int c, int d)
{
int sum= c+d;
printf(“Sum = %d”, sum);
}
void add(int c, int d)
{
int diff= c-d;
printf(“Difference = %d”, diff);
}
इस उदाहरण मे , दो quick exit function को call किया गया है |जिसमे मे से difference वाला function पहले perform होता है |आउटपुट होगा :
enter data 43 33
Difference = 10
Sum = 77

4. EXIT_ SUCCESS
EXIT_ SUCCESS : ये macro है जो की function के success status को define करता है |
EXIT_ FAILURE : ये macro है जो की किसी function के failure status को define करता है |
इसका उदाहरण है :-

#include<stdio.h>
#include<conio.h>
void main()
{
FILE *f;
f=fopen(“Data.doc”,”w”);
if(f==NULL)
{
printf(“File can not open .”);
exit(EXIT_ FAILURE);
}
else
{
puts(e);
}
fclose(f);
return(EXIT_ SUCCESS );
}
5. at_quick_exit()
इस function का use किसी function को call करके terminate किया जाता है |इसमें function को return किया जाता है और ‘0’ return होता है अगर function call होता है अन्यथा ‘1’ return होता है |
6. atexit()
इस function का use किसी function को call करके terminate किया जाता है |इसमें function को return किया जाता है और ‘0’ return होता है अगर function call होता है अन्यथा ‘1’ return होता है |
Sbistudy

Recent Posts

four potential in hindi 4-potential electrodynamics चतुर्विम विभव किसे कहते हैं

चतुर्विम विभव (Four-Potential) हम जानते हैं कि एक निर्देश तंत्र में विद्युत क्षेत्र इसके सापेक्ष…

2 days ago

Relativistic Electrodynamics in hindi आपेक्षिकीय विद्युतगतिकी नोट्स क्या है परिभाषा

आपेक्षिकीय विद्युतगतिकी नोट्स क्या है परिभाषा Relativistic Electrodynamics in hindi ? अध्याय : आपेक्षिकीय विद्युतगतिकी…

4 days ago

pair production in hindi formula definition युग्म उत्पादन किसे कहते हैं परिभाषा सूत्र क्या है लिखिए

युग्म उत्पादन किसे कहते हैं परिभाषा सूत्र क्या है लिखिए pair production in hindi formula…

7 days ago

THRESHOLD REACTION ENERGY in hindi देहली अभिक्रिया ऊर्जा किसे कहते हैं सूत्र क्या है परिभाषा

देहली अभिक्रिया ऊर्जा किसे कहते हैं सूत्र क्या है परिभाषा THRESHOLD REACTION ENERGY in hindi…

7 days ago

elastic collision of two particles in hindi definition formula दो कणों की अप्रत्यास्थ टक्कर क्या है

दो कणों की अप्रत्यास्थ टक्कर क्या है elastic collision of two particles in hindi definition…

7 days ago
All Rights ReservedView Non-AMP Version
X

Headline

You can control the ways in which we improve and personalize your experience. Please choose whether you wish to allow the following:

Privacy Settings
JOIN us on
WhatsApp Group Join Now
Telegram Join Join Now