Find the best tutors and institutes for C Language
Search for topics
Answered on 25 Jun IT Courses/Programming Languages/C Language
Rajesh
IT developer with Experienced & skilled in AMI.
Lesson Posted on 16 Feb IT Courses/Programming Languages/C Language
Sahana D.
I have taught in an engineering college under WBUT (Now MAKAUT) for past 15 years. Streams that I taught...
Can you write two functions in which one executes before main function and other executes after the main function?
#pragma startup [priority]
#pragma exit [priority]
Where, priority is optional integer value.
For user priority varies from 64 to 255
For c libraries priority varies from 0 to 63
Default priority is 100.
pragma startup always execute the function before the main function pragma exit always execute the function after the main function. Function declaration of must be before startup and exit pragma directives and function must not take any argument and return void. If more than one startup directive then priority decides which one will execute first.
startup:
Lower value: higher priority i.e. functions will execute first. If more than one exit directive then priority decides which one will execute first.
exit:
Higher value: higher priority i.e. functions will execute first.
Example
#include<stdio.h>
void india();
void usa() ;
#pragma startup india 105
#pragma startup usa
#pragma exit usa
#pragma exit india 105
int main(){
printf("\nI am in main");
return 0;
}
void india(){
printf("\nI am in india");
}
void usa(){
printf("\nI am in usa");
}
Output:
I am in usa
I am in India
I am in main
I am in India
I am in usa
Explanation:
Above program there are two startup directives which will execute before the main function.
Function name India has priority 105
Function name usa has priority 100 (default)
So usa function will execute first than India function and above program there are two exit directive which will execute after the main function.
Function name India has priority 105
Function name usa has priority 100 (default)
So india function will execute first than usa function.
read lessAnswered on 18 Feb IT Courses/Programming Languages/C Language Tuition/BCA Tuition/C Language Programming IT Courses/Programming Languages/C++ Language/Advanced C++
Rajesh Kumar Subramanian
Microsoft .Net Technology Specialist
Looking for C Language Classes
Find best C Language Classes in your locality on UrbanPro.
Answered on 29/11/2018 IT Courses/Programming Languages/C Language Tuition/BCA Tuition/C Language Programming IT Courses/Programming Languages/C++ Language/Advanced C++
Rampreet Thakur
Computer Software Trainor
Answered on 29 Jan IT Courses/Programming Languages/C Language Tuition/BCA Tuition/C Language Programming IT Courses/Programming Languages/C++ Language/Advanced C++
Rajib Das
Answered on 20/12/2018 IT Courses/Programming Languages/C Language IT Courses/Programming Languages/C++ Language/Advanced C++ Tuition/BCA Tuition/C Language Programming
Narendra
Computer Science Tutor
Answered on 28 Jan IT Courses/Programming Languages/C Language IT Courses/Programming Languages/C++ Language/Advanced C++ Tuition/BCA Tuition/C Language Programming
Kabyashree Sahu
Answered on 05 Feb IT Courses/Programming Languages/C Language Tuition/BCA Tuition/C Language Programming IT Courses/Programming Languages/C++ Language/Advanced C++
Ramkesh
Tutor
There is no language and database in software industries that you can call as most important. It keeps changing. It's entirely depend upon your requirment. Each languages has its uniqueness and hence important in its domain.
Check below point for further clarification:
Java for Application software developers
C/C++ for System software (Utilities/Device drivers/Embedded Systems) developers.
Python for AI, ML, DL and Data Science application developers.
JS for front-end developers.
read lessAnswered on 11 Feb IT Courses/Programming Languages/C Language Tuition/BCA Tuition/C Language Programming IT Courses/Programming Languages/C++ Language/Advanced C++
Firzana F.
Looking for C Language Classes
Find best C Language Classes in your locality on UrbanPro.
Answered on 09/05/2015 IT Courses/Programming Languages/C Language
Srinivasa Thirunagari
Expert In Computer Languages
UrbanPro.com helps you to connect with the best C Language Classes in India. Post Your Requirement today and get connected.
Ask a Question