comparing character arrays

This is a discussion on comparing character arrays within the C++ Programming forums, part of the General Programming Boards category; would someone be able to show me were to start please i have a problem when im trying to compare ...

  1. #1
    Registered User
    Join Date
    May 2002
    Posts
    15

    Question comparing character arrays

    would someone be able to show me were to start please i have a problem when im trying to compare 2 charater arrarys.The first character array has read in module codes from a text file the second has stored user input. Ive called a function of type bool to compare the two arrays if they match i want to return true if they dont then false.

    Ive tried to use a subscript but it ends up printing all the strings stored in the array.

  2. #2
    Veni Vidi Vice
    Join Date
    Aug 2001
    Posts
    343
    Here

    And Im sure you would find it here too.

  3. #3
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145
    strcmp() compares two strings (NULL terminated character arrays). If you only have character arrays, use memcmp() instead.
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Manipulating Character arrays in functions.
    By kbro3 in forum C++ Programming
    Replies: 11
    Last Post: 08-16-2008, 02:24 AM
  2. Question on character arrays
    By Countfog in forum C Programming
    Replies: 9
    Last Post: 04-30-2008, 01:06 AM
  3. Character Arrays
    By JHaney in forum C++ Programming
    Replies: 6
    Last Post: 10-27-2005, 12:53 PM
  4. multidimentional character arrays
    By ckeener in forum C++ Programming
    Replies: 7
    Last Post: 03-11-2005, 07:49 PM
  5. A question concerning character arrays
    By ellipses in forum C Programming
    Replies: 3
    Last Post: 03-08-2005, 07:24 PM

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