Thread: Location of Character in Char Array

  1. #1
    Registered User
    Join Date
    Jul 2009
    Posts
    10

    Location of Character in Char Array

    Is there a way to point to a specific point in a char array and determine if a specific character exists at this point?
    ie:
    Code:
    if(array[2] == ',')
    // do something
    Thanks.

  2. #2
    Registered User GL.Sam's Avatar
    Join Date
    Aug 2009
    Posts
    88
    Yes. Also:

    char *strchr(const char *s, int c);
    Searches for the first occurrence of c (converted to char) in the string pointed to by s; the null character is part of the string; returns a pointer to the first occurrence, or NULL if none is found.
    The only good is knowledge and the only evil is ignorance.
    ~Socrates

  3. #3
    Registered User
    Join Date
    Jul 2009
    Posts
    10
    Awesome, got it to work perfectly. Thanks.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need help understanding info in a header file
    By hicpics in forum C Programming
    Replies: 8
    Last Post: 12-02-2005, 12:36 PM
  2. linked list inside array of structs- Syntax question
    By rasmith1955 in forum C Programming
    Replies: 14
    Last Post: 02-28-2005, 05:16 PM
  3. How do you search & sort an array?
    By sketchit in forum C Programming
    Replies: 30
    Last Post: 11-03-2001, 05:26 PM
  4. Hi, could someone help me with arrays?
    By goodn in forum C Programming
    Replies: 20
    Last Post: 10-18-2001, 09:48 AM