How can i change the priority of function?
I want to run nay other function before execution of main() function.
san_sarangkar 0 Newbie Poster
Recommended Answers
Jump to PostYou can't. The main() function is, by definition, the first function your program runs.
What difference does it make? Just call your function first thing in main:
int main() { my_init_func(); ...
Hope this helps.
Jump to PostYou might try something like ...
#include <iostream> using namespace std; struct test { void myfunction() { cout << "myfunction()\n"; } test() { myfunction(); } }; static test testing; int myfunction2() { cout << "myfunction2\n" << endl; return 43; } static int test2 = myfunction2(); int main(void) …
All 7 Replies
Duoas 1,025 Postaholic Featured Poster
san_sarangkar 0 Newbie Poster
VernonDozier 2,218 Posting Expert Featured Poster
stilllearning 148 Posting Whiz
mitrmkar 1,056 Posting Virtuoso
VernonDozier commented: Impressive. +7
VernonDozier 2,218 Posting Expert Featured Poster
ArkM 1,090 Postaholic
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.