compare contents of strings

This is a discussion on compare contents of strings within the C Programming forums, part of the General Programming Boards category; I have an int arrays[5] I need to compare two of them to see if they are full or not ...

  1. #1
    Max
    Max is offline
    Registered User Max's Avatar
    Join Date
    Jul 2002
    Posts
    110

    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
    Posts
    9,796
    If you have an array of five integers then you're not comparing strings. Can you show us some of your code?

    -Prelude
    My best code is written with the delete key.

  3. #3
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    >>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, 04:03 PM
  4. Comparing Strings
    By Perica in forum C++ Programming
    Replies: 6
    Last Post: 02-12-2003, 10:41 PM
  5. how do i compare strings
    By bart in forum C++ Programming
    Replies: 17
    Last Post: 08-30-2001, 09:17 PM

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