#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2013
    Posts
    3
    Rep Power
    0

    Help on simple c program


    I am trying to write a program which gets a certain character from a string however i am unsure on how to do this?
  2. #2
  3. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2013
    Location
    Saint-Petersburg, Russia
    Posts
    240
    Rep Power
    29
    Fetch it by index since string is a char array in C.
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2013
    Posts
    3
    Rep Power
    0
    Originally Posted by rodiongork
    Fetch it by index since string is a char array in C.
    Yes but what is the base code for doing this??
  6. #4
  7. Contributing User
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jan 2003
    Location
    USA
    Posts
    7,255
    Rep Power
    2222
    Any array access code that's out there.

    Or are you needing to find the index (AKA "position") of a specific character, eg '@', inside a string that you are given? Then consult the string functions in strings.h, such as strchr.

    Your question is far too general for us to figure out just what it is that you want to know. Examples would help. But barring that, as long as you keep your questions overly general, then you will receive answers of equal generality.
  8. #5
  9. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2013
    Posts
    3
    Rep Power
    0
    Originally Posted by dwise1_aol
    Any array access code that's out there.

    Or are you needing to find the index (AKA "position") of a specific character, eg '@', inside a string that you are given? Then consult the string functions in strings.h, such as strchr.

    Your question is far too general for us to figure out just what it is that you want to know. Examples would help. But barring that, as long as you keep your questions overly general, then you will receive answers of equal generality.
    Thanks for the help.

IMN logo majestic logo threadwatch logo seochat tools logo