Explanation of main() Function using Sample Program
main प्रत्येक c program का एक हिस्सा है C मुख्य विवरण के विभिन्न रूपों की अनुमति देता है main function के निम्नलिखित रूपों की अनुमति है।
- main()
- int main()
- void main()
- main(void)
- void main(void)
- int main(void)
The empty pair of parentheses indicates that the function has no arguments This mas be explicitly indicated by using the keyword void inside the parentheses.
We may also specify the keywords ' int ' or ' void ' before the word ' main ' . The keyword void means that the function does not return any information to the operating system and int means that function returns an integer value to the operating system.
प्रत्येक C Program को specific structure का पालन करना होता है।
For Example :
main( )
{
/* . .. . . . . . . . . . . . Printing begins . . . . . . . . . */
printf(" Hello Engineer Page ");
/* . . . . . . . . . . . . . . .printing ends . . . . . . . . . . . */
}
Output :
Hello, Engineer Page
Let us understand the program. पहली line system को सूचित करती है कि function का नाम main है और execution इस line पर शुरू होता है।
The main() function has control over the other parts of the program. Every program has one main function and if we use more than one main function then the compiler does not understand from where the program begins. The empty pair of parentheses indicates that the main function has no arguments.
The opening brace " { " indicates the beginning of the function and the " } " indicates the end of the function with end of the program. The statements between the braces is the function body The function body contains a set of instructions to perform the given task.
In the function body the executable line is the printf line.The lines beginning with /* and ending with */ are known as comment lines. Comment lines are not executable statements.
Let us now look at the printf() function, the only executable statement of the program printf("Hello", I see);
printf आउटपुट को प्रिंट करने के लिए एक predefined standard C function है। Printf फ़ंक्शन starting and the ending quotation marks के बीच सब कुछ print करने का कारण बनता है। parentheses के बीच निहित जानकारी को 'argument of the function' कहा जाता है।


0 Comments