Thread: help with an error

  1. #1
    Registered User
    Join Date
    May 2002
    Posts
    3

    help with an error

    hi, i only have 3 errors to get, and they are all

    'letf operand must be l-value'

    just wondering if anyone can help

    heres the code

    Code:
     /*
    
    		void sort (int room_number_array[], char name_array[][20], int num_people_array[], char destination_array[], int SIZE_array)
    	{
    	int outer_index = SIZE;
    	int inner_index;
    	int elements_switched = TRUE;
    
    	int temp_room_num;
    	char temp_name[20] =  {"\0"};
    	char temp_dest;
    	int temp_num_people;
    
    	while ( (elements_switched == TRUE) && (outer_index >= 1)) {
    
    		inner_index = 0;
    		elements_switched = FALSE;
    		while (inner_index <= outer_index-1) {
    			if (room_number_array[inner_index] > room_number_array [inner_index + 1]){
    
    				temp_room_num = room_number_array[inner_index];
    				room_number_array [inner_index] = room_number_array [inner_index + 1];
    				room_number_array [inner_index + 1] = temp_room_num;
    
    		        ERROR-> temp_name = name_array[inner_index];
    			ERROR->	name_array[inner_index] = name_array [inner_index+1];
    			ERROR->	name_array[inner_index + 1] = temp_name;
    
    				temp_num_people = num_people_array[inner_index];
    				num_people_array[inner_index] = num_people_array [inner_index+1];
    				num_people_array[inner_index + 1] = temp_num_people;
    
    				temp_dest = destination_array[inner_index];
    				destination_array[inner_index] = destination_array [inner_index+1];
    				destination_array[inner_index+1] = temp_dest;
    
    				elements_switched = TRUE;
    			}
    			inner_index++;
    		}
    		outer_index--;
    	}
    
    	return;
    }
    */

  2. #2
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145
    You cannot copy the contents of a string (char array) with the = operator. Use strcpy();
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

  3. #3
    Me want cookie! Monster's Avatar
    Join Date
    Dec 2001
    Posts
    680
    What's the ERROR-> doing in your code?

  4. #4
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    Originally posted by Monster
    What's the ERROR-> doing in your code?
    That'll be highlighting the lines the compilers moaning about, I expect
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Getting an error with OpenGL: collect2: ld returned 1 exit status
    By Lorgon Jortle in forum C++ Programming
    Replies: 6
    Last Post: 05-08-2009, 08:18 PM
  2. An error is driving me nuts!
    By ulillillia in forum C Programming
    Replies: 5
    Last Post: 04-04-2009, 09:15 PM
  3. Making C DLL using MSVC++ 2005
    By chico1st in forum C Programming
    Replies: 26
    Last Post: 05-28-2008, 01:17 PM
  4. Connecting to a mysql server and querying problem
    By Diod in forum C++ Programming
    Replies: 8
    Last Post: 02-13-2006, 10:33 AM
  5. Couple C questions :)
    By Divx in forum C Programming
    Replies: 5
    Last Post: 01-28-2003, 01:10 AM