can argv[0] be null in C?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • chaturengg
    New Member
    • May 2010
    • 1

    #1

    can argv[0] be null in C?

    argv[0] contains the name used to invoke the program. Is there any circumstance
    that it possible that it will contain null string “”?
  • Banfa
    Recognized Expert Expert
    • Feb 2006
    • 9067

    #2
    Yep if you call main yourself. That is only allowable in C, that is the C++ standard prohibits calling main recursively but the C standard does not as such you could all it yourself with a blank argv[0].

    But the first time main is called argv[0] will always contain the program name.

    Comment

    Working...