Please what is wrong with this code? | Sololearn: Learn to code for FREE!

0

Please what is wrong with this code?

I recently started studying c and I don't know why I am getting an error on this code .someone help please https://code.sololearn.com/cv05MebGEwQV/?ref=app

c

7/5/2022 10:15:15 AM

steve Purpose

17 Answers

New Answer

+2

Where is main method?

+1

William Owens you saw the corrected code..I wrote the code without the main(){}.Never knew it was mandatory.sites like w3schools didn't specify so.

+1

Most sites are not very specific about the published C standard to ease the learning process. Keep learning and hopefully the folks in the community will give you some tips along the way to get better and closer to standard. Hope to see see of your work soon.

+1

steve Purpose w3 schools does specify. main() Line 3: Another thing that always appear in a C program, is main(). Every example up to this page displays it https://www.w3schools.com/c/c_syntax.php

0

I thought it is a function on it's own.Do we use it with every variable declaration and operation

0

steve Purpose Whatever you write in main method shall run.

0

Ok..I've added it and it worked.But all the documentation from weschools and 1 or two others didn't say to always add main

0

Ok I see

0

Side note: it's a function, not method. Methods are object behaviour, while functions are stand-alone.

0

Nothing is "wrong" with that code. I would however use main like int main(void){} and your output is going to be on the same line as your prompt think about adding a new line.

0

Respek William Owens ✌️

0

William Owens you can view my few projects on my profile..My arcade coin counter app and my boxing round timer app..You can also follow my GitHub link on my profile to my GitHub .

0

Please write return 0; when u r using int data type

0

https://code.sololearn.com/WCopZXel5AKI/?ref=app

0

Thank you Chanda. It Can work with any non zero value actually.you can return 1 or 2

0

Thanks for the information, I will try to figure it out for more. Keep sharing such informative post keep suggesting such post. https://www.marykayintouch.ltd/

0

GarciaF1 what is this link?