this post was submitted on 21 Dec 2025
359 points (100.0% liked)

Technology

77843 readers
2913 users here now

This is a most excellent place for technology news and articles.


Our Rules


  1. Follow the lemmy.world rules.
  2. Only tech related news or articles.
  3. Be excellent to each other!
  4. Mod approved content bots can post up to 10 articles per day.
  5. Threads asking for personal tech support may be deleted.
  6. Politics threads may be removed.
  7. No memes allowed as posts, OK to post as comments.
  8. Only approved bots from the list below, this includes using AI responses and summaries. To ask if your bot can be added please contact a mod.
  9. Check for duplicates before posting, duplicates may be removed
  10. Accounts 7 days and younger will have their posts automatically removed.

Approved Bots


founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
[–] xthexder@l.sw0.com 26 points 11 hours ago (6 children)

Hello World in 1974: echo.c

main(argc, argv)
int argc;
char *argv[];
{
	int i;

	argc--;
	for(i=1; i<=argc; i++)
		printf("%s%c", argv[i], i==argc? '\n': ' ');
}
[–] ZoteTheMighty@lemmy.zip 10 points 10 hours ago (5 children)

Bloat, they wasted an extra integer operation with argc--.

[–] xthexder@l.sw0.com 9 points 10 hours ago (4 children)

I think it's actually quite elegant. No matter what it has to skip over argument 0 which will be the executable name echo.
If the subtraction was removed and the loop changed to <, it would then need to do an addition or subtraction inside the loop to check if it's the last argument.

[–] surewhynotlem@lemmy.world 4 points 10 hours ago

Or they just drop the =

load more comments (3 replies)
load more comments (3 replies)
load more comments (3 replies)