Can you think of a way when a program crashed before
reaching main? If yes how?

Answers were Sorted based on User's Feedback



Can you think of a way when a program crashed before reaching main? If yes how?..

Answer / sunil

The global variables get initialized by the c startup
functions before the main function is being called.
Hence any error in global variables will cause a crash
before reaching the main.

Is This Answer Correct ?    5 Yes 0 No

Can you think of a way when a program crashed before reaching main? If yes how?..

Answer / pyari

int foo ()
{
// It comes here before main is invoked
//Hence a crash happening in this function
obviously ,will happen before main is called


// s simple crash :)
swprintf(NULL,L"%s",L"crash");
return 1;

}

int i = foo ();

int _tmain(int argc, _TCHAR* argv[])
{
return ( 0 );
}

Is This Answer Correct ?    2 Yes 1 No

Post New Answer

More C Interview Questions

What is sizeof in c?

0 Answers  


what is the significance of static storage class specifier?

0 Answers  


What is f'n in math?

0 Answers  


How does #define work?

0 Answers  


implement OR gate without using any bitwise operator.

1 Answers   Alcatel, Wipro,






what is reason of your company position's in india no. 1.

0 Answers   Accenture, TCS,


Write a program for print infinite numbers

3 Answers   Wipro,


What is %s and %d in c?

0 Answers  


Is there a way to jump out of a function or functions?

0 Answers  


Explain pointers in c programming?

0 Answers  


What is meant by errors and debugging?

0 Answers  


What is indirect recursion? give an example?

4 Answers  


Categories