passing an argv to a function as a stored string
<p>Can anyone explain why the cout in the getMessage() function doesn't read out. My goal is to pass an argv[i] as a previously stored value. </p>

<p>Here is a my code so far. I'm new to command line args any help would be great.</p>

<pre><code>#include &lt;iostream&gt;
#include &lt;string&gt; 
using namespace std;

void getMessage(string action);

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

    string action = argv[1];    
    cout &lt;&lt; action &lt;&lt; endl;
}

void getMessage(string action)
{
    cout &lt;&lt; "I said " &lt;&lt; action &lt;&lt; endl;

}
</code></pre>