Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: question about xCode and C



You don't have anything in your code that needs a header.

If you changed printf() to fprintf (stderr, "hello\n"); then it will complain until you #include <stdio.h> to define stderr.

Regards, Rob.

On 29 Jan 2005, at 12:33 am, Michael de Haan wrote:

Dear List,

I am relatively new to  C...

I am having difficulty understanding the following: ( I am reading Brian Overland's "C in plain English")

As an illustration, he shows how to enter something like this, without anything else.

void main() {
printf( " foo bar !  \n");
}

... and explains how to C this is like any other function that needs to be defined before being used, and hence the need to add " #include <stdio.h> " in the first line.

Well, I just typed it without the # include and ......printed just fine, although I had expected to receive a warning "undefined etc etc". . I did this both in Terminal and Xcode and got the exact same warning but both printed ok......

I know there are real C gurus on the list...any explanation as to why it seems to work without adding the includes on Xcode or terminal?

Tks

_______________________________________________ Do not post admin requests to the list. They will be ignored. Xcode-users mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/xcode-users/email@hidden

This email sent to email@hidden
References: 
 >question about xCode and C (From: Michael de Haan <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.