i am seeing this error:
error C2106: '=' : left operand must be l-value

here is the code

bool swap;
		int numTemp;
		char charTemp[30];
		int count;

		do
		{
			swap = false;
			for (count = 0; count < (size -1); count++)
			{
				if (array[count] > array[count + 1])
				{
					numTemp = array[count];
					charTemp = stud[count];
					array[count] = array[count +1];
					stud[count] = stud[count + 1];
					array[count + 1] = numTemp;
					stud[count +1] = charTemp;
					swap = true;
				}
			}
		} while (swap);

what im trying to do is when the value gets swapped i want the character array to be swapped with it.

after searching around some more i found that arrays cant be set to something like the way i have it set up. i found that changing char charTemp[30]; to string charTemp; seem to fix some of them, but i cant set the array back for the swap, if that makes sense.

You can't say:

int a[100], b[100];
a = b;

That doesn't make sense. You can't change the value of a.

What would make sense is what you said: "i want the character array to be swapped with it." In other words, you want to exchange the values in the two arrays. This will require a loop:

for (int i = 0; i < 100; i++) {
  int t = a[ i ];
  a[ i ] = b[ i ];
  b[ i ] = t;
  }

Hope this helps.

im not looking for the int to be swapped in this case, i can do thats much, its the char array that i want to switch.

so as an example:
jill is in the first column and
jam is in the second column

i need those name to switch array locations. so that when i call stud[0] i get jam and stud[1] i get jill

You're not paying attention.

char student[ SIZE ][ COLS ];

for (int i = 0; i < COLS; i++) {
  char c = student[ 0 ][ i ];
  student[ 0 ][ i ] = student[ 1 ][ i ];
  student[ 1 ][ i ] = c;
  }

so in other words the swap between the whole word cannot be done with arrays, so to actually do the swap every letter needs to be changed out. i get it now, thanks for the help, and happy thanksgiving! =]

heres my final code:

void bubbleSort(int *score, char stud[][COL], int size)
	{
		bool swap;
		int temp;
		int count;
		char c;

		do
		{
			swap = false;
			for (count = 0; count < (size -1); count++)
			{
				if (score[count] > score[count + 1])
				{
					temp = score[count];
					score[count] = score[count +1];
					score[count + 1] = temp;

					for (int i = 0; i < COL; i++)
					{
						c = stud[count][i];
						stud[count][i] = stud[count +1][i];
						stud[count +1][i] = c;
					}
					swap = true;
				}
			}
		} while (swap);
		cout << "Here are the sorted test values:\n";
		for (count = 0; count < size; count++)
			cout << score[count] << " ";
		cout << endl;
	}
This article has been dead for over six months. Start a new discussion instead.