4.2.6. Exit() Function, Chapter - 4, Control Structures, HSSC-II (12th Class) Computer Science Key Point Notes

4.2.6. Exit() Function, Chapter - 4, Control Structures, HSSC-II (12th Class) Computer Science Key Point Notes

12th Class (HSSC-II) Computer SLO Based Key Point Notes

(National Book Foundation - As Federal Textbook Board, Islamabad 
Based on National Curriculum Pakistan 2023-2024 and Onward prescribed by Federal Board of Intermediate and Secondary Education, Islamabad, and All Pakistan Boards) 

{Contact WhatsApp 03339719149 for Class-XII Computer Science Complete SLO-Based Key Points notes in pdf format as well as in PowerPoint Presentation for preparing/delivering the Lectures}

************************************

👉👉👉 Computer Science 12th Class Notes (Main Page)

************************************

Unit 4: Control Structures

4.2.6 Exit() Function

The exit() function is used to terminate a C++ program before its normal termination and exit to the operating system. It requires the standard library header file stdlib.h.

The following is the general form of the exit function.

            exit (value);

Here, value is an integer value or integer variable. It is known as the exit code. The exit code "0" exits a program without any error and exit code "1" indicates that an error must have occurred. It helps the programmer in debugging the program.

Consider the following if-else statement.
           if(n>0)
            cout<<n<<"is a positive number";
            else
            exit(0);

In the above if-else statement, the control function exit is used to terminate the execution of the if-else statement if the value of n is not greater than 0 and returns to the operating system.


************************************
👉👉👉 Computer Science 12th Class Notes (Main Page)

************************************


************************************
Shortcut Links For:

1.  5th Class All Subjects Notes

2.  8th Class All Subjects Notes

3.  Easy English Grammar Notes



1. Website for School and College Level Physics   
2. Website for School and College Level Mathematics  
3. Website for Single National Curriculum Pakistan - All Subjects Notes 

© 2023 & onwards Academic Skills and Knowledge (ASK  

Note:  Write me in the comments box below for any query and also Share this information with your class-fellows and friends.


Post a Comment

0 Comments

cwebp -q 80 image.png -o image.webp