Function help
sokin
Posts: 32
I am trying to display the values of startVal, endVal and incVal, and have the for statement start at 10 and multiply until it reaches 100. I get an error message like this Function with Parameter (1).c:26:2: error: expected identifier or '(' before '{' token
Done. Build Failed!
Can I have some insight into what I am doing wrong? Thanks y'all.
Click error or warning messages above to debug.
#include "simpletools.h" // Include simpletools
void counter(int startVal, int endVal, int incVal); // Function prototype
int main() // main function
{
counter(6, 100, 1 * 2); // Call value function
}
void counter(int startVal, int endVal, int incVal) // value function
{
print("The value is: startVal = %d\n", startVal); // Display a single value
print("The value is: endVal = %d\n", endVal); // Display a single value
print("The value is: incVal = %d\n", incVal); // Display a single value
}
{
for(int i = startVal;... i = endval;... i = incVal)
{
print("i = %d\n", i);
}
}
Done. Build Failed!
Can I have some insight into what I am doing wrong? Thanks y'all.
Click error or warning messages above to debug.
#include "simpletools.h" // Include simpletools
void counter(int startVal, int endVal, int incVal); // Function prototype
int main() // main function
{
counter(6, 100, 1 * 2); // Call value function
}
void counter(int startVal, int endVal, int incVal) // value function
{
print("The value is: startVal = %d\n", startVal); // Display a single value
print("The value is: endVal = %d\n", endVal); // Display a single value
print("The value is: incVal = %d\n", incVal); // Display a single value
}
{
for(int i = startVal;... i = endval;... i = incVal)
{
print("i = %d\n", i);
}
}
Comments
Function with Parameter (1).c: In function 'counter':
Function with Parameter (1).c:26:23: error: expected expression before '...' token
Function with Parameter (1).c:26:38: error: expected expression before '...' token
Done. Build Failed!