C/C++ Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingC/C++ Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old February 26th, 2005, 12:14 AM
Veilside Veilside is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2005
Posts: 2 Veilside User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 19 m 25 sec
Reputation Power: 0
Sorting an array of random words....please help

K guys, I have a bit of a problem sorting an array of random words. The thing is like this: 2 functions create an array 'data' that contains random words. My task is to create some functions, that combined together and used in the selection sort algorithm and in the quicksort algorithm will result in the array being sorted.
So far, so good.
for example, if my functions will be like:
'void selection(char *data, int size)' then everything will be perfect, but the major problem that I have is that I have to declare the function in this way:
'void selection (void *data, int size)'
Well, so far, so good again...because inside the function i can declare sth like this:
'void selection (void *data, int size)'
{
char *s;
s=(char *)data;
}
and now i have access to the data variable that I will be transferring from the main program.It works perfect, as long as I have only one word, not a WHOLE ARRAY. When I have an array of strings, I cannot see the array inside the function 'selection'. Aparently I can see only it's first value, but the others are gone.
I have tried many things, but none of them seems to work(includeing a clever way: typedef a structure that contains an array of strings, and then using a pointer to that structure...but none of them seems to work.)
Please give any advice, if any. I don't need the entire code, I know perfectly what I have to do, it's just that I'm stuck with the process of transfering an array to a function that takes as a parameter a void pointer!

Thank and Best Regrds,
Veilside

Reply With Quote
  #2  
Old February 27th, 2005, 02:56 PM
Veilside Veilside is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2005
Posts: 2 Veilside User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 19 m 25 sec
Reputation Power: 0
Got it, I found my silly mistake, thanks anyway!

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingC/C++ Help > Sorting an array of random words....please help


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway
Stay green...Green IT