Whether there can be main inside another main?If so how does
it work?
Answers were Sorted based on User's Feedback
Answer / namita
main()
{
main();
}
This code snippet will result in infinite loop.
| Is This Answer Correct ? | 43 Yes | 15 No |
Answer / divyansh
main marks the beginning of a program, 2 direct mains can't
be there as it will make the compiler dumb!(literally),in
this case it will give an error, or an infinite loop
operation will be executed.
| Is This Answer Correct ? | 21 Yes | 3 No |
Answer / nilanjan
Surely. . It will just act like a recursive version of
main(), which will run infinite times if there is no
limiting condition specified.
Sample:
#include <stdio.h>
int main()
{
int static i = 0;
printf("\nFile is too big.");
while(i == 0)
{
i++;
main();
}
return 0;
}
| Is This Answer Correct ? | 21 Yes | 3 No |
Answer / vara
there will be no error but the output will go in infinite
loop
main()
{
int a=2,b=3;
a=a+b;
b=a-b;
a=a-b;
printf("%d",&a);
printf("%d",&b);
main();
getch();
}
| Is This Answer Correct ? | 19 Yes | 5 No |
Answer / rajdesai143
yes.There can be any no of main inside the main.But one
static main should be required .In that we can call any no
of times it just works as recursive.
Since one static main is required because (astart) requires
that . Its a startup code
| Is This Answer Correct ? | 9 Yes | 0 No |
Answer / gprabha
#include<stdio.h>
void main()
{
printf("main()");
main();
getch();
}
| Is This Answer Correct ? | 3 Yes | 1 No |
Answer / harinath
yes there can be
for example
main()
{
static int count=50;
printf("%d",count--);
while(count>0)
main();
}
here the output is numbers upto 1 then it comes out of it.
| Is This Answer Correct ? | 1 Yes | 1 No |
what are the advantage of pointer variables? write a program to count the number of vowels and consonants in a given string
using only #include <stdio.h> and #include <stdlib.h> Write a program in C that will read an input from the user and print it back to the user if it is a palindrome. The string ends when it encounters a whitespace. The input string is at most 30 characters. Assume the string has no spaces and distinguish between and lowercase. So madam is a palindrome, but MadAm is not a palindrome. Use scanf and %s to read the string. Sample Test: Enter a string: madam madam is a palindrome. Enter a string: 09023 09023 is not a palindrome.
enum { SUNDAY, MONDAY, TUESDAY, }day; main() { day =20; printf("%d",); getch(); } what will be the output of the above program
Hi, main() { } Is a user defined function or Built in Functionn
24.what is a void pointer? 25.why arithmetic operation can’t be performed on a void pointer? 26.differentiate between const char *a; char *const a; and char const *a; 27.compare array with pointer? 28.what is a NULL pointer? 29.what does ‘segmentation violation’ mean? 30.what does ‘Bus Error’ mean? 31.Define function pointers? 32.How do you initialize function pointers? Give an example? 33.where can function pointers be used?
main() { printf("\n %d %d %d",sizeof('3'),sizeof("3"),sizeof(3)); } wat is the o/p and how?
p*=(++q)++*--p when p=q=1 while(q<=6)
the question is that what you have been doing all these periods (one year gap)
1) int main() { unsigned char a = 0; do { printf("%d=%c\n",a,a); a++; }while(a!=0); return 0; } can anyone please explain the explain the output
WRITE A CODE IN C TO SEARCH A FILE FROM NOTEPAD FILE.
Write a program that will read the input of any number of digits n in a row of shafh showing the breakdown of the printing and printing figures by the recursive function.
WHY DO WE USE A TERMINATOR IN C LANGUAGE?