Re: newbie question: how to compare char?

From: Eric Sosman (Eric.Sosman_at_sun.com)
Date: 04/08/04


Date: Thu, 08 Apr 2004 16:59:54 -0400

Paula wrote:
>
> Hi,
>
> i guess this is a stupid question, but i'm used to pascal and i'm
> having problems in understanding char and strings in c...
>
> How can I compare the char value at a given position in a string? I
> mean, I'm trying:
>
> ...
> char file_iso[30];
> ...
>
> if (file_iso[11] == "a") alfafe=0.5; else alfafe = 0.0;
>
> but it doesn't work...
>
> Thx
> Paula

        if (file_iso[11] == 'a') ...

    Single and double quotes have entirely different
meanings in C source. You would do well to review
Question 8.1 -- in fact, all of Section 8 -- in the
comp.lang.c Frequently Asked Questions (FAQ) list

        http://www.eskimo.com/~scs/C-faq/top.html

-- 
Eric.Sosman@sun.com


Relevant Pages

  • Re: newbie question: how to compare char?
    ... Paula wrote: ... > i guess this is a stupid question, but i'm used to pascal and i'm ... > having problems in understanding char and strings in c... ... > How can I compare the char value at a given position in a string? ...
    (comp.lang.c)
  • Re: Begineers question on Guitar action ?
    ... Hope this is not a stupid question, I am a begineer to guitar. ... The strings on the old acoustic I have been given are 1mm above the ... fret on the nut end of the fingerboard but about 6mm above the fret at ...
    (rec.music.makers.guitar)
  • Re: Begineers question on Guitar action ?
    ... Hope this is not a stupid question, I am a begineer to guitar. ... The strings on the old acoustic I have been given are 1mm above the ... fret on the nut end of the fingerboard but about 6mm above the fret at ...
    (rec.music.makers.guitar)
  • Re: newbie question: how to compare char?
    ... Martin Ambuhl wrote: ... > Paula wrote: ... >> i guess this is a stupid question, but i'm used to pascal and i'm ... apropos than what we done wot of.) ...
    (comp.lang.c)
  • Re: String comparison
    ... > I'm sorry for such a stupid question, I am fairly new to VB. ... > provided with the following code to compare two strings... ... > the text in the label. ...
    (microsoft.public.scripting.vbscript)

Loading