cassius Posted October 21, 2012 Share Posted October 21, 2012 Hello Is there an exit statement in c?I need to end program at a certain point.by jumping out of main loop. Quote amd quad core 4 ghz / geforce 660 ti 2gb / win 10 Blender,gimp,silo2,ac3d,,audacity,Hexagon / using c++ Link to comment Share on other sites More sharing options...
gamecreator Posted October 21, 2012 Share Posted October 21, 2012 Are you looking for this? Quote Link to comment Share on other sites More sharing options...
Pixel Perfect Posted October 21, 2012 Share Posted October 21, 2012 The normal way of doing this would be to use the break; statement. This will leave the nearest enclosing loop or conditional statement in which it appears without exiting the program and continue program execution from there. Quote Intel Core i5 2.66 GHz, Asus P7P55D, 8Gb DDR3 RAM, GTX460 1Gb DDR5, Windows 7 (x64), LE Editor, GMax, 3DWS, UU3D Pro, Texture Maker Pro, Shader Map Pro. Development language: C/C++ Link to comment Share on other sites More sharing options...
Rick Posted October 21, 2012 Share Posted October 21, 2012 One way would be to have the loop condition be your way out. Generally my main loop looks like: while(!quit) { } And then I set quit to true to exit the main loop in whatever situation I need. Quote Link to comment Share on other sites More sharing options...
cassius Posted October 21, 2012 Author Share Posted October 21, 2012 What I had in mind was how to exit program when main character is killed. EDIT: ok thanks all. I used ricks method "while(maincharacter.alive" Quote amd quad core 4 ghz / geforce 660 ti 2gb / win 10 Blender,gimp,silo2,ac3d,,audacity,Hexagon / using c++ Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.