3

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)?

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.

  • 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 '14 at 3:57
  • 1
    It depends on the compiler, not the platform. But most are like this. – Ignacio Vazquez-Abrams Dec 12 '14 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 '15 at 8:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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