redefinition of formal parameter
Jan 19, 2013 at 4:34pm UTC
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
Jan 19, 2013 at 4:40pm UTC
> where this is happening
`attemp2.cpp(213)': between the parenthesis is the line number.
It would be line 2 in your example.
Jan 19, 2013 at 4:41pm UTC
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 Jan 19, 2013 at 4:41pm UTC
Jan 19, 2013 at 4:42pm UTC
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 Jan 19, 2013 at 4:42pm UTC
Jan 19, 2013 at 5:53pm UTC
yes it means im defining them again sorry silly mistake
Topic archived. No new replies allowed.