Thread: Filling an array and searching for a value

  1. #1
    Registered User
    Join Date
    Dec 2010

    Filling an array and searching for a value

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

  2. #2
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    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
    Quote Originally Posted by alex83 View Post
    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, 01: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