File talk:C Hello World Program.png

来自Wikimedia Commons
跳转到导航 跳转到搜索

Underspecified prototypes[编辑]

The prototypes for these functions should be `(void)`, not `()`. 2601:646:8401:848B:3C95:35C2:CBC3:6E9F 03:12, 18 December 2015 (UTC)[回复]

Um ... these aren't prototypes; they're function definitions. And most compilers will allow 'function() {..}' definitions. Yes, C99+ deprecates this in favour of 'function(void) {..}' ... but remember that some of us have been programming C since the K&R days and have 20 prior years of bad habits. Mrstonky (留言) 06:16, 8 February 2016 (UTC)[回复]
"Pedants are men who would appear to be learned, without the necessary ingredient of knowledge." — George Bancroft

Suggested Improvements[编辑]

Since this image is used on the “Programming language” page, it should be of the best possible quality.

  • the return type of main should be int, not void
  • the output should be terminated with a newline, otherwise it might not show at all
  • the image should have some empty pixel lines below code line 24, since currently the image looks as if the code would continue below that line

--2A02:2028:82F:1B01:CCB2:CC2F:9EC2:924D 10:11, 20 March 2016 (UTC)[回复]

I agree on all three counts, and can add a fourth one: C (as opposed to C++) doesn't support // comments. I might have to make a new version of the image. Perhaps it's a better idea to recreate the image altogether, typing the correct code into an IDE with syntax colouring either here at home or at work. JIP (留言) 20:18, 26 May 2016 (UTC)[回复]
Agreed with these three points. The image should reflect real world C programming style. Also the colour contrast between the background and the code is poor. CrasherX (留言) 19:26, 19 June 2018 (UTC)[回复]