need a little help with if statements and strings

This is a discussion on need a little help with if statements and strings within the C Programming forums, part of the General Programming Boards category; Need to know the proper way to make this type of comparison. char *ChTest="test"; int h2; if (ChTest=="test")h2 = 3; ...

  1. #1
    Registered User
    Join Date
    Dec 2001
    Posts
    104

    need a little help with if statements and strings

    Need to know the proper way to make this type of comparison.
    char *ChTest="test";
    int h2;
    if (ChTest=="test")h2 = 3;
    Thanks in advance.

  2. #2
    Mayor of Awesometown Govtcheez's Avatar
    Join Date
    Aug 2001
    Location
    MI
    Posts
    8,825
    Use strcmp

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Problem Using Strings in IF statements
    By Programmer3922 in forum C Programming
    Replies: 6
    Last Post: 08-02-2008, 01:36 PM
  2. sscanf and parsing strings
    By jco1323 in forum C Programming
    Replies: 4
    Last Post: 02-20-2008, 05:32 PM
  3. Using strings in if statements
    By Brittany in forum C Programming
    Replies: 5
    Last Post: 03-14-2005, 04:15 PM
  4. if statements using strings as the condition
    By trang in forum C Programming
    Replies: 7
    Last Post: 12-13-2003, 04:20 PM
  5. Switch statements for strings
    By cxs00u in forum C++ Programming
    Replies: 5
    Last Post: 04-17-2002, 03:38 PM

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