C
Comp1597
On Visual Studio 2008 Express, I compiled and ran the following
program:
#include "stdafx.h"
#include <iostream>
int main(int argc, char * argv[])
{
std::cout << argc;
}
At the Visual Studio Command Prompt, I entered ProjectName.exe(3, "a",
"b", "c")
My thinking was that argc denotes the number of string arguments to
the main function. This is indicated by the 3 strings "a", "b" and
"c" and by the first integer parameter which I set to 3.
So I expected that argc==3 and that therefore the output would be 3.
However, the output was 2
I'd be grateful if someone could explain this.
Thanks in advance.
program:
#include "stdafx.h"
#include <iostream>
int main(int argc, char * argv[])
{
std::cout << argc;
}
At the Visual Studio Command Prompt, I entered ProjectName.exe(3, "a",
"b", "c")
My thinking was that argc denotes the number of string arguments to
the main function. This is indicated by the 3 strings "a", "b" and
"c" and by the first integer parameter which I set to 3.
So I expected that argc==3 and that therefore the output would be 3.
However, the output was 2
I'd be grateful if someone could explain this.
Thanks in advance.