c - Weird Issue With argv in if statement -


i'm having problems argv in if statement in 1 of c programs. know must missing simple , stupid (it's been while since i've done in c). problem is, won't dootherstuff() if specify nothing else on command line. if ./a.out -i still runs dostuff(). see might missing here? thank lot in advance!

int main(int argc, char *argv[])      if(argv[1] == "-a" || "-a")     {        dostuff();     }     else     {         dootherstuff();     } } 

if want compare strings in c have use methods strcmp: http://www.cplusplus.com/reference/cstring/strcmp/

in c string array of characters, comparing memory address of 2 arrays (which different of course since different arrays).


Comments

Popular posts from this blog

ios - iPhone/iPad different view orientations in different views , and apple approval process -

java Extracting Zip file -

C# WinForm - loading screen -