Re: conditional if..else
Re: conditional if..else
- Subject: Re: conditional if..else
- From: "Clark Cox" <email@hidden>
- Date: Tue, 17 Jul 2007 12:01:38 -0700
On 7/17/07, Frank Murray <email@hidden> wrote:
Hello,
This is a new post, and I am relatively new to the XCode IDE.
As others have already pointed out, this is a basic C FAQ. The
comp.lang.c newsgroup is a good place for questions like this, as long
as you can tolerate the, at times, harsh regulars there :).
fjm
#include <stdio.h>
int main (int argc, const char * argv[]) {
char scale[12];
printf ("Enter the temperature scale you're coming from, either Celcius or
fahrenheit.\n");
scanf ("%s", &scale);
However, I have to add that using scanf like this is asking for
trouble (e.g. what happens if the user enters more than 11
characters?). Read up on the fgets function; when used properly, it
can protect you from issues like this.
--
Clark S. Cox III
email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden