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

  • Home
  • SEARCH
  • 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 6993305
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T19:44:51+00:00 2026-05-27T19:44:51+00:00

In any C program, the command line argument argv[0] points to the name used

  • 0

In any C program, the command line argument argv[0] points to the name used to invoke the program. Is there any circumstance in which it will point to an empty string ""?

An example code snippet for such a case would be a good reference.

  • 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-27T19:44:52+00:00Added an answer on May 27, 2026 at 7:44 pm

    It’s implementation defined. §5.1.2.2.1 abridged:

    • If the value of argc is greater than zero, the array members argv[0] through
      argv[argc-1] inclusive shall contain pointers to strings, which are given
      implementation-defined values by the host environment prior to program startup. The
      intent is to supply to the program information determined prior to program startup
      from elsewhere in the hosted environment. […]

    • If the value of argc is greater than zero, the string pointed to by argv[0]
      represents the program name; argv[0][0] shall be the null character if the
      program name is not available from the host environment. […]

    So if argc is greater than zero, it’s quite the intention that argv[0] never be an empty string, but it could happen. (Note that with argc equal to n, argv[0] through argv[n - 1] are never null and always point to a string. The string itself may be empty, though. If n is zero, argv[0] is null.)

    In practice, of course, you just need to make sure the platforms your targetting behave as needed.

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

Sidebar

Related Questions

Are there any command line interpreters or any other set of programs around for
I have a C program that displays it's command-line by iterating through the argv
I've had a tough time setting up my replication server. Is there any program
Can some one recommend any free program which counts the number of clicks Clicked
i have a program that needs command line arguments in the form : ./my_program
I have a string with possible command line arguments (using an Read-Eval-Print-Loop program) and
I have a CGI script (compiled C program) that outputs its command line arguments
I'm writing a program in Python that accepts command line arguments. I am parsing
I am writing a contact management program. I know how to read command-line arguments,
I am writing a program where if no command line arguments are supplied i.e

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.