undefined variable

Dec 5, 2015 at 6:05am
Hello.
I am defining my variable outside my function quickSort() and when used it inside the function I get this error. Why is that?
Dec 5, 2015 at 6:20am
Hi,

We need to see the code, there is not enough info in your question. Preferably something we can compile.

If you have errors, then post them here in full and verbatim. Make sure the line numbers match with your code.

Cheers :+)
Dec 5, 2015 at 7:17am
This:

int count=0;
void quickSort(int a[],int base , int n)
{
...
count+=n-1;
....
}
Dec 5, 2015 at 7:32am
You wouldn't happen to have using namespace std; and be using the algorithm header would you?

count exists in the std namespace.

As well as not using the entire std namespace, I prefer not to have variable names the same as the std ones.

Also:

TheIdeasMan wrote:
We need to see the code, there is not enough info in your question. Preferably something we can compile.

If you have errors, then post them here in full and verbatim. Make sure the line numbers match with your code.


And code tags, with 252 posts, I thought you might have been aware of that by now :+)
Topic archived. No new replies allowed.