+ 7

Why brackets are given after main function in c program?

28th Sep 2019, 10:54 AM
Souvik Sen
Souvik Sen - avatar
13 Respuestas
+ 7
Every function need to be define by using function_name()
28th Sep 2019, 11:54 AM
Aditya Saha
Aditya Saha - avatar
+ 5
I am talking about () brackets.
28th Sep 2019, 11:05 AM
Souvik Sen
Souvik Sen - avatar
+ 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😉
28th Sep 2019, 12:17 PM
Kidfand
+ 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.
28th Sep 2019, 11:30 AM
HonFu
HonFu - avatar
+ 2
Main is also a function. Therefore, you have to put brackets after the function name to declare the arguments.
28th Sep 2019, 5:32 PM
Queenie Rose C. Ongcal
Queenie Rose C. Ongcal - avatar
+ 1
A block of code of a function has to be enclosed in brackets. int main() { here's the code...} ^ ^ opens closes
28th Sep 2019, 11:01 AM
HonFu
HonFu - avatar
+ 1
The parentheses tell how the main function can pass in arguments when called.
28th Sep 2019, 11:38 AM
Seb TheS
Seb TheS - avatar
+ 1
This is why we are using Python. Lol only joke. (There is no need for main function in python)
30th Sep 2019, 4:30 AM
CoderTR
+ 1
what if i dont put the brackets ,does this just works to not declare any arguements
1st Jan 2024, 2:19 PM
Razor Xhibit
Razor Xhibit - avatar
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. 🏵🌹🥀🌺🌻🌼🌷🌾💮🌸💐
29th Sep 2019, 1:42 PM
Nithya Yamasinghe
Nithya Yamasinghe - avatar
0
Just like normal functions, you can pass arguments to the main function. They are called command line arguments I think
17th Jun 2021, 12:11 PM
Rishi
Rishi - avatar
- 2
()
29th Sep 2019, 3:51 PM
19bq1a0480