LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices



Reply
 
Search this Thread
Old 10-17-2009, 07:13 PM   #1
smeezekitty
Senior Member
 
Registered: Sep 2009
Location: Washington U.S.
Distribution: M$ Windows / Debian / Ubuntu / DSL / many others
Posts: 2,234

Rep: Reputation: 189Reputation: 189
is this ansi C?


first this is not homework just had a personal question
is this code ANSI C?
Code:
#undef DOS_WIN
#define UNIX
int main(){
void print_hello_world(){
printf("Hello world");
#ifdef UNIX
printf("\n");
#endif
#ifdef DOS_WIN
printf("\r\n");
#endif
}
print_hello_world();
}
 
Old 10-17-2009, 07:46 PM   #2
neonsignal
Senior Member
 
Registered: Jan 2005
Location: Melbourne, Australia
Distribution: Debian Wheezy (Fluxbox WM)
Posts: 1,368
Blog Entries: 52

Rep: Reputation: 354Reputation: 354Reputation: 354Reputation: 354
No, you can't have nested function definitions. If you specify '-pedantic', gcc will give you the appropriate warning. (Incidentally, you also need a prototype for the printf).

Last edited by neonsignal; 10-17-2009 at 07:47 PM.
 
Old 10-17-2009, 07:59 PM   #3
smeezekitty
Senior Member
 
Registered: Sep 2009
Location: Washington U.S.
Distribution: M$ Windows / Debian / Ubuntu / DSL / many others
Posts: 2,234

Original Poster
Rep: Reputation: 189Reputation: 189
thats what i thought
 
  


Reply

Tags
standard


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
3 Questions about ANSI-C SpLaSh212 Programming 6 01-03-2009 11:28 AM
How to read F1,F2 in Ansi C? john.daker Programming 4 11-05-2008 10:36 AM
Ansi Telnet thebutler4 Linux - Software 1 05-25-2004 01:58 PM
Is this ansi-c compliant? xailer Programming 5 12-26-2003 09:49 PM
ANSI C Manual rajaram Programming 6 01-05-2002 08:39 PM


All times are GMT -5. The time now is 09:27 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration