Advertisement

Returning a string in C/C++

Started by January 21, 2001 02:13 PM
1 comment, last by Nazrix 24 years ago
Sorry for spamming. I posted this in the Lounge on accident: Basically I want to return a string in the form of *location and put into some sort of variable... Here's my class and declaration of items_database
        
class DB_Items
{
public:
	int number;
	char *location;
};

DB_Items items_database[3];
   
Here's part of the Database function:
          
char *return_string DataBase(int look_up_type, int look_up_category,int index)
{
    for (int item_search=0; item_search<=3; item_search++)
    {
	if (items_database[item_search].number==index)
	{
	   return (items_database[item_search].location);
	}
    }

}
          
So, I am just trying to return items_database[item_search].location Am I making any sense? http://www15.brinkster.com/nazrix/main.html "All you touch and all you see is all your life will ever be --Pink Floyd Need help? Well, go FAQ yourself. Edited by - Nazrix on January 21, 2001 3:19:48 PM
Need help? Well, go FAQ yourself. "Just don't look at the hole." -- Unspoken_Magi
Instead of

  char *return_string DataBase(int look_up_type, int look_up_category,int index)//do thischar *DataBase(int look_up_type, int look_up_category,int index)  


That should solve the problem. Unless I''m missing something....
==========================================In a team, you either lead, follow or GET OUT OF THE WAY.
Advertisement
oh okay that makes sense...thanks

http://www15.brinkster.com/nazrix/main.html

"All you touch and all you see is all your life will ever be --Pink Floyd
Need help? Well, go FAQ yourself.
Need help? Well, go FAQ yourself. "Just don't look at the hole." -- Unspoken_Magi

This topic is closed to new replies.

Advertisement