2

As it says in the title. I have been searching but I cant seem to find the answer.

What is the difference between void setup() and void setup(void) as well as void loop() and void loop(void)?

1 Answer 1

8

Absolutely nothing, in modern versions of C and C++. Specifying no arguments is the same as specifying void.

In old versions of C a function with no arguments took a single implicit int argument or allowed you to specify the arguments on a separate line, but no one uses anything like that nowadays.

3
  • Thanks. This is for the case of the Arduino. But what about other boards like say the Sparkcore? No difference as well?
    – suckms
    Dec 12, 2014 at 3:57
  • 1
    It depends on the compiler, not the platform. But most are like this. Dec 12, 2014 at 3:58
  • 2
    Up to C99, an empty parentheses meant any number of arguments (not just one int). Though obsolete in C99, it is still supported.
    – Omer
    Jan 7, 2015 at 8:14

Not the answer you're looking for? Browse other questions tagged or ask your own question.