Developer community
0 votes
42 views
asked by Guru (24.6k points) 30 54 84 | 42 views

1 Answer

0 votes
In C, program execution starts from the main() function. Every C program must contain a main() function. The main function may contain any number of statements. These statements are executed sequentially in the  order which they are written.

The main function can in-turn call other functions. When main calls a function, it passes the execution control to that function. The function returns control to main when a return statement is executed or when end of  function is reached. In C, the function prototype of the 'main' is one of the following:

int main(); //main with no arguments

int main(int argc, char *argv[]); //main with arguments

The parameters argc and argv respectively give the number and value of the program's command-linearguments.

Example:

#include <stdio.h>

/* program section begins here */

int main() {

// opening brace - program execution starts here

printf("Welcome to the world of C");

return 0;

}/

/ closing brace - program terminates here

Output:

Welcome to the world of C
answered by Guru (39.1k points) 10 22 36

Related questions

0 votes
1 answer
asked by sara Guru (24.6k points) 30 54 84 | 58 views
0 votes
1 answer
asked by pax Sr Member (3.2k points) 6 13 27 | 3.8k views
0 votes
1 answer
asked by john Guru (27.1k points) 34 52 102 | 56 views
+1 vote
1 answer
asked by steve Sr Member (1.5k points) 8 23 36 | 107 views
0 votes
1 answer
asked by keem Expert (13.2k points) 27 43 61 | 26 views
Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true

Categories


C Books Guide and List
C++ Books Guide and List
Best Java Books

3.8k questions

4k answers

117 comments

10.7k users

3,754 questions
4,046 answers
117 comments
10,709 users