void main()
{
printf("Hello World");
}
Explain:-
Here,
‘#include<stdio.h>’
-- is known as pre-processor directory.
“#include” -- is a
header folder or directory.
stderr. stdin is used for
input, stdio is used for output and stderr
is used for error.
“.h” -- is
a extension name of the file.
“void main()”-- is a main
function, and ‘main’ is the function name.
Without creating a main function, we
cannot execute any program.
‘{‘ -- is indicates the start of
the main function.
‘printf’ -- is used for print something to
console window.
‘Hello world’ -- is a commend that will be output.
‘;’ -- is known as a terminator,
which is used to indicates the end of line.
‘}’ -- is indicates the end of the
main function.
If we are declare ‘int
main()’ replace of ‘void main()’ though the program is correct. We can just
declare a return value at the end of the main function using return keyword,
the return value should be an integer because the data type of the function
(main) is an integer. If we declare the main function as a char or float then
we should declare the return value something like ‘c’ and in case of float it
should be ‘6.0’.
Originally the reason is,
when the main() function completes execution, it needs to notify the operating
system about it’s completion. This is the reason why the last statement in
main() is return any value.
The
operating system considers the value that is returned to it to imply that the
program has completed execution without any error.
No comments:
Post a Comment
Thanks For Giving Comment In Our Blog.