Thread: Array Query

  1. #1
    Unregistered
    Guest

    Array Query

    I have created an array which holds info on records - but i need to be able to search thru the records to find one of them

    also i need it to be able to just search for just the first couple of letters, so that a list of the results can be stored in another array.

    can any1 help please

    CRS

  2. #2
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    I have created an array which holds info on records - but i need to be able to search thru the records to find one of them

    also i need it to be able to just search for just the first couple of letters, so that a list of the results can be stored in another array.

    can any1 help please
    "I'd like to by a... FOR LOOP please!"

    Is your list sorted or unsorted? If it's unsorted, just use a for() loop and go through the list. If it's sorted, use a binary search. In either case, if you're comparing strings, then, oddly enough, you want the strcmp or strncmp function.

    Quzah.
    Hope is the first step on the road to disappointment.

  3. #3
    Unregistered
    Guest
    Cheers, strncmp will work ok

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 16
    Last Post: 05-29-2009, 07:25 PM
  2. from 2D array to 1D array
    By cfdprogrammer in forum C Programming
    Replies: 17
    Last Post: 03-24-2009, 10:33 AM
  3. Replies: 6
    Last Post: 11-09-2006, 03:28 AM
  4. Quick question about SIGSEGV
    By Cikotic in forum C Programming
    Replies: 30
    Last Post: 07-01-2004, 07:48 PM
  5. Array Program
    By emmx in forum C Programming
    Replies: 3
    Last Post: 08-31-2003, 12:44 AM