User Profile
Collapse
-
I'm not claiming it's ANSI/ISO standard. But I now know, the reason it's void main() for microprocessors is because there's no operating system to return the int to, and most microprocessor programs end in an infinite loop, so a return value would be useless anyway.... -
maybe not, but microcontroller s do strange things, including expecting main() to be declared as void (for the one I'm working on at the moment)...Leave a comment:
-
The solution (from another board) is:
"The reason you get an error on the int a ... is that you are not defining your variables before the start of code. In C++ you can literally put a variable definition anywhere any statement can go. Some C compilers allow this too, but far from all. So as soon as you start writing code statements (anything that isn't a type, function or variable declaration/definition), you can not declare...Leave a comment:
-
struct member assignment (c-only)
Hi, I'm now in a job where I have to code in pure C (not C++) and am having trouble adjusting to the differences, hope you can help. As soon as I un-comment any one of the commented lines in the code snippet below, the program fails to compile with a syntax error on the "int a=0..." line after the commented block (This line isn't a problem while the rest is commented out). I haven't been able to identify the problem, even after searching...
No activity results to display
Show More
Leave a comment: