Thread: compare contents of strings

  1. #1
    Registered User Max's Avatar
    Join Date
    Jul 2002

    compare contents of strings

    I have an int arrays[5] I need to compare two of them to see if they are full or not such as comparing array[0] and array[5]. I tried strcmp but I get compiler errors telling me something like char * not compatible with int.

    any suggestions on how to go about it?

  2. #2
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    If you have an array of five integers then you're not comparing strings. Can you show us some of your code?

    My best code is written with the delete key.

  3. #3
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    >>to see if they are full
    What do you mean here?

    To compare two ints, simply use the == comparison operator.
    >if (myarray[0] == myarray[5])
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 2
    Last Post: 04-29-2009, 10:13 AM
  2. Compare strings problem
    By chelito19 in forum C Programming
    Replies: 2
    Last Post: 04-16-2009, 08:01 PM
  3. using Stacks & Queues to compare Strings
    By eskimo083 in forum C++ Programming
    Replies: 1
    Last Post: 03-09-2003, 05:03 PM
  4. Comparing Strings
    By Perica in forum C++ Programming
    Replies: 6
    Last Post: 02-12-2003, 11:41 PM
  5. how do i compare strings
    By bart in forum C++ Programming
    Replies: 17
    Last Post: 08-30-2001, 09:17 PM