If (argv[1] != argv[1]) { Why(); } //?

Visual C++ 2008 Express Edition
1
2
3
4
5
6
7
8
9
10
11
12
#include <iostream>
#include <fstream>
using namespace std;

int main(int argc, char* argv[])
{
   if (argv[1] == "-c")
   {
      cout << "Arg1 -c called.";
   }
   return 0;
}


This program returns false on the if check. Debug mode shows argv[1] to be "-c" and a cout of argv[1] will display -c as well but the dependent code never executes.

Using;
 
if (argv[1] == '-c')

(single quotes instead) gives me the compiler errors:

error C2446: '==' : no conversion from 'int' to 'char *'
error C2040: '==' : 'char *' differs in levels of indirection from 'int'


It's not a crippling error, but I don't understand it and can only guess as to it's cause. I'd appreciate it if someone could explain away some of my ignorance.
Topic archived. No new replies allowed.