Thread: array contains?

  1. #1
    Registered User
    Join Date
    Jul 2008

    array contains?

    is there any command in C that scans elements in an array to find a certain string? i have a student records program im working on that has last names and marks of an imaginary class. i want to have an option to type in the students last name and change their mark. id have a pretty good idea if there were some kind of command that can read the contents of an array? thanks.

  2. #2
    Join Date
    Dec 2007
    Google for strstr.

  3. #3
    Registered User valaris's Avatar
    Join Date
    Jun 2008
    RING 0
    You have char * array? Scan through each last name comparing them. strcmp(). When it returns true, take note of where the last name was in the array and do whatever you wanted to do to it.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 16
    Last Post: 05-29-2009, 07:25 PM
  2. Replies: 6
    Last Post: 11-09-2006, 03:28 AM
  3. [question]Analyzing data in a two-dimensional array
    By burbose in forum C Programming
    Replies: 2
    Last Post: 06-13-2005, 07:31 AM
  4. Unknown Memory Leak in Init() Function
    By CodeHacker in forum Windows Programming
    Replies: 3
    Last Post: 07-09-2004, 09:54 AM
  5. Quick question about SIGSEGV
    By Cikotic in forum C Programming
    Replies: 30
    Last Post: 07-01-2004, 07:48 PM