Hey List,
I have what is hopefully a beginners C question which will be easily answered (this following little app is for converting watts, amps and volts);
I have the following code: http://pastebin.com/m30x4G17
The problem I have is although the code works, it is because I have used the strncmp function to compare the first pasted argument and a string value such as "-watts", "-volts" or "-amps" because without it I was getting errors about comparing integers and pointers but I am confused as to why C thinks this.
Using if(argv[1]=="-watts") produces no errors but the if statements are never hit, as in the if statement is never met and the code is never run. How should I be coding this to make these comparisons?