title: Pass command line argument to a sub function
body: <p>I have a C program main routine which calls heirarchically several levels of functions. Eg :</p>
  
  <pre><code>main -&gt; MyFunc -&gt; MySubFunc -&gt; MySub2Func
  </code></pre>
  
  <p>and I have a condition in MySub2Func which needs to be checked against a command line argument. Eg:</p>
  
  <pre><code>if (myvar == argv[1]) 
  </code></pre>
  
  <p>Other than passing argv as a parameter to subfunction , is there any other way I could acheive this. (because I need to do this in several functions lying at different heirarchical levels) </p>
  
  <p>Each of the sub-functions lie in different C files. My aim is to perform a debug by temporarily checking a particular local variable against a cmd line argument (and taking further actions accordingly) .. hence modifying the entire heirarchy is unfortunately not desirable for my purpose.</p>
  
  <hr>
  
  <p>[update from comment]</p>
  
  <p>sorry that I forgot to mention .. i am trying to perform a debug by temporarily checking a particular local variable against a cmd line argument (and taking further actions accordingly) .. hence modifying the entire heirarchy is unfortunately not desirable for my purpose ..</p>