redefinition of formal parameter

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
void Quicksort(int info[],int left,int right){
int left;
int right;
int pivot = left + (right - left)/2;//it is the middle (will change sometimes but will end up in the middle
int temp;

while(left<=right){
	while(info[left] < pivot){
	left++;
	}
	while(info[right] < pivot){
	right--;
	}
	//swap feature
	if(left<=right){
	temp =	info[left];
	info[left]=info[right];
	info[right] = temp;

	left ++;
	right --;
	}


}

}



1
2
3
1>c:\users\faieq\documents\visual studio 2010\projects\attempt 2 challange 1\attempt 2 challange 1\attemp2.cpp(213): error C2082: redefinition of formal parameter 'left'
1>c:\users\faieq\documents\visual studio 2010\projects\attempt 2 challange 1\attempt 2 challange 1\attemp2.cpp(214): error C2082: redefinition of formal parameter 'right'
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========



that's the errorim getting however im not to sure where this is happening
> where this is happening
`attemp2.cpp(213)': between the parenthesis is the line number.
It would be line 2 in your example.
1
2
3
void Quicksort(int info[],int left,int right){  // <- left and right are declared here
int left;  // <-  you're declaring them again here
int right;
Last edited on
that's the errorim getting however im not to sure where this is happening

Look closely at the following snippet and compare it to your error message.
1
2
3
void Quicksort(int info[],int left,int right){
int left;
int right;

attemp2.cpp(213): error C2082: redefinition of formal parameter 'left'
attemp2.cpp(214): error C2082: redefinition of formal parameter 'right'


Do you know what redefinition means?
Last edited on
yes it means im defining them again sorry silly mistake
Topic archived. No new replies allowed.