What's wrong with the globle variable??

Here is the code:
#include <iostream>
using namespace std;
int first;
int goal;

int Tempor_ans=0;
char Tempor_op[7];
char op[20][10];
int No_of_solu=0;
int replace=0;

void isGoal(int operand_no ,int first,int array[] ,int sequ,int goal)
{

if (operand_no>1)
{
Tempor_ans=first+array[sequ];
Tempor_op[sequ-1]='+';
if (operand_no>2)
{
isGoal(operand_no,Tempor_ans,array,sequ+1,goal);
if(Tempor_ans==goal&&operand_no==2)
{

for(int i=0;i<replace;i++)
op[No_of_solu][i]=Tempor_op[i];
No_of_solu++;

}
}
}


that the complier have a error said the first declared as `int replace'
and
`replace' was not declared inside the function

also use of `replace' is ambiguous

what's wrong with the code????

There is a standard library function replace and you have a variable called replace so compiler can't decide which one you want to use. One way to solve is to remove using namespace std; from your code or just simply rename the variable.
This is a great example of the many reasons why using namespace xxx; is evil.
Topic archived. No new replies allowed.