Can you think of a way when a program crashed before
reaching main? If yes how?
Answers were Sorted based on User's Feedback
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 |
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 |
What is the benefit of using const for declaring constants?
How can I return multiple values from a function?
main() { int ptr[] = {1,2,23,6,5,6}; printf("%d",&ptr[3]-&ptr[0]); }
What is main () in c?
What are the 4 types of functions?
how we can say java is platform independent, while we require JVM for that particular Operating System?
Describe the order of precedence with regards to operators in C.
main() { char *p1="Name"; char *p2; p2=(char *)malloc(20); while(*p2++=*p1++); printf("%s\n",p2); }
What is the advantage of c?
what is pointer?
13 Answers HCL, TCS,
the maximum length of a character constant can be a) 1 character b) 8 characters c) 256 chaacters d) 125 characters
Write a c program to demonstrate character and string constants?