Re: Re: [c-prog] How to execute the user defined ...

Shiju Krishnan <[email protected]> Fri, 30 Dec 2005 09:14:01 +0530
Newsgroups gmane.comp.programming.cppug
Message-ID <[email protected]>
#include<stdio.h>
int before()
{
    printf("HELLO\n");
    return 1;
}
int i = before();

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

this work out on solaris

Regards
Shiju K.

On 12/28/05, sumit kumar <[email protected]> wrote:
>
>  At 05:54 2005-12-27, Jitendra Kumar wrote:
> >Hi all to the members of wonderful forum,
> >
> >Y'day i had an interview, this was the qstn:
> >
> >Write a program which will execute before the main
> >function, dont use #pragma or compiler level programs?
>
> what language?  If C++, trivial:   write a struct
> or class with your program in the constructor.
> define an instance as a global variable.
>
> in C?  I have no idea.
>
>
> >Pls post the answer.
> >Thanku,
> >
> >Jitendra
>
>
> *Maneesh Anand Samria <[email protected]>* wrote:
>
> Lets try this
> #include<stdio.h>
> int before()
> {
>  printf("HELLO");
>  return 1;
> }
> int i = before();
> void main()
> {
>  printf("main");
> }
>  This wont work since initialiser must be a constant.
>
> Regards,
> Sumit kumar
>
> ------------------------------
> Yahoo! for Good - Make a difference this year.<http://us.rd.yahoo.com/mail_us/taglines/charity/*http://brand.yahoo.com/cybergivingweek2005/>
>  ------------------------------
> YAHOO! GROUPS LINKS
>
>
>    -  Visit your group "cppug <http://groups.yahoo.com/group/cppug>" on
>    the web.
>
>    -  To unsubscribe from this group, send an email to:
>     [email protected]<[email protected]?subject=Unsubscribe>
>
>    -  Your use of Yahoo! Groups is subject to the Yahoo! Terms of
>    Service <http://docs.yahoo.com/info/terms/>.
>
>
>  ------------------------------
>
>