Re: program bug




"Robert Gamble" <rgamble99@xxxxxxxxx> wrote in message
news:2d73e006-fc0d-4ed7-ae1e-43535dea6140@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Not a portable return value from main.

}
if (argv[1]=="b") {

This isn't doing what you think it is. This is comparing the address
of first program argument to the address of the string literal "b"

Was declaring b as a pointer to char proper? Or should a simple b of
type char all that's needed?


which will always be different. Either use (strcmp(argv[1], "b") ==
0) or say:

if (argv[1][0] == 'b') {

which will compare the first letter of the first argument to the
character constant b.

I do not understand the above but it looks like a good way to write
code. Why is a zero used as the second dimension of this array?

Bill



.



Relevant Pages

  • Re: c# - Interlocked.Exchange and value types
    ... for comparing and assigning enum values? ... Declaring the variable as ... volatile should do the job, if I read the docs correctly. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: How to determine if object (recordset) is set?
    ... you are not entirely correct that comparing an object to nothing ... does not alter the object. ... And surprise surprise the output is "rs is NOT nothing". ... Bottom line is that the "as new" syntax for declaring an object variable ...
    (microsoft.public.vb.database.ado)
  • Re: Variable declaration - C vs script style
    ... when declaring variables within loops ... comparing to all forward declarations. ... I'm mostly writing up to a few ... If the limiting factor in your script ...
    (comp.lang.perl.misc)