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

HOW TO ANSWER IF ASKED " WHAT KIND OF A PERSON ARE YOU?" I NEED AN ANSWER THAT IMPRESS THE INTERVIEWER

4 Answers  


given the piece of code int a[50]; int *pa; pa=a; to access the 6th element of the array which of the following is incorrect? a.*(a+5) b.a[5] c.pa[5] d.*(*pa + 5)

6 Answers   amu, TCS,


c program to compute AREA under integral

0 Answers   Infosys,


What does c mean in standard form?

0 Answers  


What is a pointer variable in c language?

0 Answers  






What’s a signal? Explain what do I use signals for?

0 Answers  


What is pragma in c?

0 Answers  


What is atoi and atof in c?

0 Answers  


What is a ternary operator in c?

0 Answers  


Write a program to check armstrong number in c?

0 Answers  


What is union in c?

0 Answers  


What is typedef example?

0 Answers  


Categories