I have been left with some Arduino sketches and in them, the previous owner has used:
I understand that setup is a run-once function and that the void before hand denotes that the function will not be returning any values/variables. But what is the idea of also putting (void) in the brackets? I am not too familiar with arduino (I assume this is C/C++ or a variant of?), usual parlance is that whatever is in the brackets is the variable you are passing to the function from the main program. I don't see the point of putting void in brackets, but that maybe because I don't understand it.
Can anyone clear this up?
The first void means the function does not return a value. The second void means the function takes no arguments. Now, in C++ (but not C), it is perfectly acceptable to omit the second void:
extern void setup();
void setup ()
The reason for having the void represent no argument is due to the original C standards process of which I was a member from about 1983 through the release of the standard as an ANSI standard in 1989 and reissued as an ISO standard in 1990.
In the original C language before the standards process, there were no prototypes to describe how the function would be called. If the user passed the wrong types or too many/too few, that was just too bad. One of the major changes to the C standards process was to import the notion of prototypes from the then new language C++ into C. However, C++ was a stricter language than C, and it required that a prototype for a function be in scope before you referenced it. So the problem was:
already had a meaning in the original C language, i.e. you were declaring that the setup function returned nothing, but nothing was said about what arguments were passed. You could call setup with no arguments, one argument, etc. So in the standards committee, we added using void to mean that you were declaring the full prototype, and that the function setup took no arguments. Before it began its own standardization practice, the C++ language was changed to allow void to mean no arguments.
Now, you might protest that you haven't had to have a declaration in scope before making a call under the Arduino. That is because the Arduino IDE tries to be helpful, and it scans your code, and tries to add prototypes for each of the functions. For simple cases, it gets it right, but there are cases where the preprocessor gets it wrong.
If you are interested, the way you had a function in the original C language was (this is not legal to C++, which is used in the Arduino):
extern int foo ();
int foo (a)