how to create c progarm without void main()?

Answer Posted / surya bhagavan s

#include<stdio.h>
#include <unistd.h>

_start()
{
_exit(my_main());
}

int my_main(void)
{
printf("Hello\n");
return 42;
}

for compilation

gcc -o3 -nostartfiles example.c

Is This Answer Correct ?    2 Yes 7 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the use of a conditional inclusion statement in C?

821


GIven a sequence of characters. How will you convert the lower case characters to upper case characters. ( Try using bit vector - sol given in the C lib -> typec.h)

855


find the sum of two matrices and WAP for it.

881


What is the use of ?: Operator?

884


What are extern variables in c?

728


Why c is faster than c++?

793


What is the use of structure padding in c?

788


why programs in c are running with out #include? some warnings are display in terminal but we execute the program we get answer why? eg: main() { printf("hello world "); }

1511


how to create duplicate link list using C???

2259


Which one to choose from 'initialization lists' or 'assignment', for the use in the constructor?

782


What is difference between array and pointer in c?

748


What is integer constants?

787


What is exit() function?

744


Can you please explain the difference between exit() and _exit() function?

809


Write a C program that will accept a hexadecimal number as input and then display a menu that will permit any of the following operations to be carried out: Display the hexadecimal equivalent of the one's complement. (b) Carry out a masking operation and then display the hexadecimal equivalent of the result. (c) Carry out a bit shifting operation and then display the hexadecimal equivalent of the result. (d) Exit. If the masking operation is selected, prompt the user lor the type of operation (bitwise and, bitwise exclusive or, or bitwise or) and then a (hexadecimal) value for the mask. If the bit shifting operation is selected. prompt the user for the type of shift (left or right), and then the number of bits. Test the program with several different (hexadecimal) input values of your own choice.

5091