Arduino Forum

Development => Suggestions for the Arduino Project => Topic started by: Butchalline on Feb 14, 2011, 12:50 am

Title: sample code in reference does not compile ( IDE 022)
Post by: Butchalline on Feb 14, 2011, 12:50 am

Here is the link:  http://www.arduino.cc/en/Reference/FunctionDeclaration

Here is the compile error: [font=Verdana]function_2_demo:6: error: function definition does not declare parameters[/font]

Here is the code that does not compile:

void setup(){
  Serial.begin(9600);
}

void loop{
  int i = 2;
  int j = 3;
  int k;

  k = myMultiplyFunction(i, j); // k now contains 6
  Serial.println(k);
  delay(500);
}

int myMultiplyFunction(int x, int y){
  int result;
  result = x * y;
  return result;
}
Title: Re: sample code in reference does not compile ( IDE 022)
Post by: retrolefty on Feb 14, 2011, 01:24 am
Looks like a typro/error in the reference, missing () after loop.

Quote
Here is the code that does not compile:

void setup(){
  Serial.begin(9600);
}

void loop(){
  int i = 2;
  int j = 3;
  int k;

  k = myMultiplyFunction(i, j); // k now contains 6
  Serial.println(k);
  delay(500);
}

int myMultiplyFunction(int x, int y){
  int result;
  result = x * y;
  return result;
}
Title: Re: sample code in reference does not compile ( IDE 022)
Post by: Butchalline on Feb 14, 2011, 03:14 pm
Thanks to Retrolefty

That is indeed correct.  Now how do we get the web page corrected?
Title: Re: sample code in reference does not compile ( IDE 022)
Post by: mellis on Feb 21, 2011, 11:09 pm
Fixed.