Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3355194
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T02:21:55+00:00 2026-05-18T02:21:55+00:00

I just saw this here #include <stdio.h> int main(int argc, char *argv[printf(Hello, world!\n)]) {}

  • 0

I just saw this here

#include <stdio.h>

int main(int argc, char *argv[printf("Hello, world!\n")]) {}

What this does is print “Hello World!”

But what’s actually going on here?

The best I can guess is that it gets compiled and thrown at the top of the execution stack, but the syntax doesn’t even look legal to me …

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T02:21:56+00:00Added an answer on May 18, 2026 at 2:21 am

    The code makes use of C99’s variable-length array feature, which lets you declare arrays whose size is known only at run-time. printf returns an integer equal to the number of characters that were actually printed, so the code prints “Hello, world!” first and uses the return value as the size of argv. The main function itself does nothing. The actual call to printf itself probably goes into the startup code generated by the compiler, which in turn calls main.

    Edit: I just checked the disassembly of the code generated by gcc and it appears that the call to printf goes inside main itself, before any other code.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

const static int foo = 42; I saw this in some code here on
I just saw this browser here: http://www.dietriffic.com/ Now, the green section at the top,
i saw an unusual problem in this code: #include <iostream> using namespace std; int
just saw this comment in a what JS lib do you use poll @Xanti
I just saw this question and one of the answers looks really appealing to
I just saw this topic: Datatable vs Dataset but it didn't solve my doubt
I just saw this code while studying the wordpress source code (PHP), You can
I just saw this cool feature of JQuery which is JQuery Portlet http://jqueryui.com/demos/sortable/portlets.html I
I just saw this dating site on builtwithbootstrap and have a question about table
I just saw this term on a job I was applying for and I'm

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.