I just started writing in C. So any help is appreciated. This is a program to find all the pairs of numbers that add to give the inputted number
I get error:Code:// Main Function void _main(int a1) { // Find All Numbers where int a + int b = a1 // Start by finding the size of array needed // Odd integers have (a-1)/2 values // Even have a/2 values if ( ( a1%2 ) == 1 ) { int adders = ((a1 - 1) / 2); } else { int adders = (a1 / 2); } // Iniate array and store values int adderarray[adders][2]; for (int i;i <= adders; i++) { adderarray[(i-1)][0] = i; adderarray[(i-1)][1] = (a1 - i); } }
'adders' undeclared (first use in this function).
So when the array 'adderarray' is declared the variable adders doesn't exsist, right? But it should have a value from the If/else statement?
I'm trying to figure out why it is wrong not just what is wrong. Thanks for helping.