Re: newbie question: how to compare char?
From: Eric Sosman (Eric.Sosman_at_sun.com)
Date: 04/08/04
- Next message: Christian Bau: "Re: pointer-in-array test"
- Previous message: Régis Troadec: "Re: newbie question: how to compare char?"
- In reply to: Paula: "newbie question: how to compare char?"
- Next in thread: Martin Ambuhl: "Re: newbie question: how to compare char?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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
- Next message: Christian Bau: "Re: pointer-in-array test"
- Previous message: Régis Troadec: "Re: newbie question: how to compare char?"
- In reply to: Paula: "newbie question: how to compare char?"
- Next in thread: Martin Ambuhl: "Re: newbie question: how to compare char?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|