CFanatic

Go Back   CFanatic > Programming > C Programming

Join CFanatic Forum Now

How to completely end a program if some condition given holds true? topic posted under C Programming which is a part of Programming category in CFanatic Forum
Reply
 
Thread Tools Display Modes
  #1  
Old 12-31-2006, 12:56 AM
Junior Member
 
Join Date: Dec 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
faizankhan666 is on a distinguished road
| More
How to completely end a program if some condition given holds true?

For example if some variable lets say..a is greater than 10 then program should close....

i.e
"press any key to continue" message appears.
Reply With Quote
  #2  
Old 12-31-2006, 01:27 AM
shabbir's Avatar
Administrator
 
Join Date: Sep 2006
Posts: 1,163
Thanks: 57
Thanked 63 Times in 44 Posts
shabbir has a spectacular aura aboutshabbir has a spectacular aura about
| More
Re: How to completely end a program if some condition given holds true?

Use the exit(0) function to terminate the program
Reply With Quote
  #3  
Old 01-16-2010, 06:29 AM
Junior Member
 
Join Date: Jan 2010
Location: Nagpur, Maharashtra, India
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
rohitphulsunge is on a distinguished road
| More
Re: How to completely end a program if some condition given holds true?

Rohit Phulsunge says-


//Some lines of code
..........
if(a>10)
{
printf("\n Press any key to continue");
getch();
exit(0);
}
............
Reply With Quote
  #4  
Old 03-11-2010, 10:08 AM
Junior Member
 
Join Date: Mar 2010
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
crmahato is on a distinguished road
| More
Re: How to completely end a program if some condition given holds true?

yes exit(0);
this will take you to end of program
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
suggest a c program SAILOLLA Game Development 7 11-20-2011 08:29 AM
Same program different O/P... !!! batman.pratik C Programming 5 10-21-2008 11:18 AM
A Windowless Program bragr Win32 Programming 2 07-12-2008 09:25 AM
Asking input file condition statement kslpeter87 C++ Programming 5 09-23-2007 09:03 PM
Help with program using classes chaching C++ Programming 0 09-30-2006 04:52 AM

 

Advertisement

CFanatic Search
Custom Search

Advertisement

All times are GMT -5. The time now is 01:21 AM.



Powered by vBulletin® Version 3.7.4
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO ©2010, Crawlability, Inc.
Cfanatic.com is a premier member of the IDG TechNetwork. For advertising opportunities contact here
Get Paid for Working on Projects Matching Your Expertise at Go4Expert's Jobs Board