User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the C section within the Software Development category of DaniWeb, a massive community of 456,553 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,460 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our C advertiser: Programming Forums
Views: 1920 | Replies: 2
Reply
Join Date: Oct 2007
Posts: 5
Reputation: skyah is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
skyah skyah is offline Offline
Newbie Poster

sorting programs

  #1  
Oct 16th, 2007
Hi. I was wondering if any one could help me with this program. I didn't get any error messages. It was excecuted but the output was incorrect. I got Unordered data: 7 3 66 3 -5 22 -77 2 After pass 1: 7 3 66 3 -5 22 -77 2 and After pass 2: 7 7 7 7 7 7 7 7. The output should be Unordered data: 7 3 66 3 -5 22 -77 2 After pass1: -77 7 66 3 3 22 -5 2 After pass 2: -77 -5 66 7 3 22 3 2.
Attached Files
File Type: doc ch9 ex11.doc (22.5 KB, 12 views)
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Sep 2004
Posts: 6,515
Reputation: Narue has much to be proud of Narue has much to be proud of Narue has much to be proud of Narue has much to be proud of Narue has much to be proud of Narue has much to be proud of Narue has much to be proud of Narue has much to be proud of Narue has much to be proud of Narue has much to be proud of 
Rep Power: 31
Solved Threads: 489
Super Moderator
Narue's Avatar
Narue Narue is offline Offline
Expert Meanie

Re: sorting programs

  #2  
Oct 16th, 2007
>void transpo_sort(int a[], int i);
This doesn't call the transpo_sort function, it declares the transpo_sort function. In other words, absolutely nothing is happening to your array.

>printf("After Pass #2:%7d,%5d,%5d,%5d,%5d,%5d,%5d,%5d \n", a[i],a[i],a[i],a[i],a[i],a[i],a[i],a[i]);
i is 0, and a[0] is 7. It's no surprise that printing a[i] eight times gives you eight 7's.
I'm here to prove you wrong.
Reply With Quote  
Join Date: May 2006
Location: ★ ijug.net ★
Posts: 1,018
Reputation: ithelp will become famous soon enough ithelp will become famous soon enough 
Rep Power: 6
Solved Threads: 68
ithelp ithelp is online now Online
Veteran Poster

Re: sorting programs

  #3  
Oct 17th, 2007
Also it is better if you post the code here than attaching an word doc.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb C Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the C Forum

All times are GMT -4. The time now is 5:21 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC