in the following code control is not going into pragma functions. Please clarify, why the control is not going inside

0 votes
asked Mar 2, 2018 by Adil Pasha (120 points)
#include <stdio.h>
void f1();
void f2();

#pragma startup f1
#pragma exit f2

int main()
{
    printf("i am in main\n");
    return 0;
}

void f1()
{
    printf("i am in f1\n");
}

void f2()
{
    printf("i am in f2\n");
}

1 Answer

0 votes
answered Mar 2, 2018 by anonymous

As explained over here,
The pragma is compiler dependent, gcc doesn't recognize startup/exit pragma. 
Similar behavior can be achieved via attribute in gcc.
Here is sample code.
https://onlinegdb.com/BkHVhvIOf
 

commented Mar 2, 2018 by Adil Pasha (120 points)
Thanks for your answer
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...