+ 7
Why brackets are given after main function in c program?
13 Antworten
+ 7
Every function need to be define by using function_name()
+ 5
I am talking about () brackets.
+ 3
That's not so important, just done for working with arguments. For example:
Int main()
Empty, that means no argument should be inside. You also have alternative variations, like:
Int main(void)
Anyway, don't pay attention on this, and just keep coding😉
+ 2
Many functions get 'arguments' (values to work with).
int f(int x, int y) {
// do stuff with x and y
// then return something
}
And if you don't need arguments for your function, the parentheses remain empty.
+ 2
Main is also a function. Therefore, you have to put brackets after the function name to declare the arguments.
+ 1
A block of code of a function has to be enclosed in brackets.
int main() { here's the code...}
^ ^
opens closes
+ 1
The parentheses tell how the main function can pass in arguments when called.
+ 1
This is why we are using Python.
Lol only joke.
(There is no need for main function in python)
+ 1
what if i dont put the brackets ,does this just works to not declare any arguements
0
✅Brackets used for passing argument
When you want to declare a function brackets used whenever you pass arguments or not.
That is a part of function declaration.
✅So that is same for the main function also.
Main is also a function.
--------------------------‐-‐-------------------------------------------------
Function Name( )
{
// implemetation of the function
}
Hope you get it.
🏵🌹🥀🌺🌻🌼🌷🌾💮🌸💐
0
Just like normal functions, you can pass arguments to the main function. They are called command line arguments I think
- 2
()