- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Write a C program to check the atexit() function
The atexit() is a function that allows the user to register a function that has to be called based on program termination.
It is a predefined function that is included in stdlib header files.
Example 1
#include<stdio.h> #include<stdlib.h> void welcome(void){ printf("Welcome to New,"); } void world(void){ printf("World
"); } int main(){ //test atexit ,call user defined function atexit(world); atexit(welcome); return 0; }
Output
Welcome to New,World
Example 2
#include<stdio.h> #include<stdlib.h> void first(void){ printf("This is a beautiful,"); } void second(void){ printf("Wonderful life
"); } int main(){ //test atexit ,call user defined function atexit(second); atexit(first); return 0; }
Output
This is a beautiful,Wonderful life
Advertisements
To Continue Learning Please Login
Login with Google