Filling an array and searching for a value

This is a discussion on Filling an array and searching for a value within the C Programming forums, part of the General Programming Boards category; wwwww...

  1. #1
    Registered User
    Join Date
    Dec 2010
    Posts
    6

    Filling an array and searching for a value

    wwwww
    Last edited by alex83; 01-16-2011 at 05:19 AM.

  2. #2
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,185
    What's sizeof(int) on your system? If it's not 8, then you won't be able to fit 10 billion into that array slot anyway. Once you know you can store the answer, then you can look at how to generate the numbers -- check RAND_MAX to see whether rand() gives you numbers that high.

    In your find function, I don't think you want those small do-while loops -- what if the rightmost element was smaller than your pivot? You'll never find it the way you have it.

  3. #3
    Programming Wraith GReaper's Avatar
    Join Date
    Apr 2009
    Location
    Greece
    Posts
    1,624
    Quote Originally Posted by alex83 View Post
    wwwww
    Hmm, your problem is quite clear to me!
    Devoted my life to programming...

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 9
    Last Post: 08-23-2010, 02:31 PM
  2. Replies: 7
    Last Post: 11-25-2008, 12:50 AM
  3. Searching between array indicies
    By Asagohan in forum C Programming
    Replies: 7
    Last Post: 04-27-2005, 12:28 AM
  4. Help with an Array
    By omalleys in forum C Programming
    Replies: 1
    Last Post: 07-01-2002, 08:31 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21