943,879 Members | Top Members by Rank

Ad:
  • C Discussion Thread
  • Unsolved
  • Views: 1283
  • C RSS
You are currently viewing page 2 of this multi-page discussion thread; Jump to the first page
Nov 13th, 2008
0

Re: Reverse a pointer to a set of integers

You have to do it for EACH i.
So put it in for loop
Reputation Points: 110
Solved Threads: 43
Posting Whiz in Training
Sci@phy is offline Offline
279 posts
since Sep 2008
Nov 13th, 2008
0

Re: Reverse a pointer to a set of integers

yes sure that's what i did and got the result 1...50...1. It's weird and i'm sure i have checked my loops a couple of times. Perhaps any other alternatives?
Reputation Points: 10
Solved Threads: 0
Newbie Poster
JpegUser is offline Offline
9 posts
since Oct 2008
Nov 13th, 2008
0

Re: Reverse a pointer to a set of integers

Please post entire code, because your code should work then.
Reputation Points: 110
Solved Threads: 43
Posting Whiz in Training
Sci@phy is offline Offline
279 posts
since Sep 2008
Nov 13th, 2008
0

Re: Reverse a pointer to a set of integers

here:

  1. int temp[ptr_size];
  2. int ptr_size2 = ptr_size;
  3.  
  4. for (i=0;i<ptr_size;i++) {
  5. temp[i] = ptr[ptr_size2--];
  6. }
  7.  
  8. for (i=0;i<ptr_size;i++) {
  9. ptr[i] = temp[i];
  10. }

The second for loop is to get back a reversed ptr.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
JpegUser is offline Offline
9 posts
since Oct 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C Forum Timeline: Vector Calculator issues (I got the code)
Next Thread in C Forum Timeline: Starting with "C"





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC