Re: program bug
- From: "Bill Cunningham" <nospam@xxxxxxxxx>
- Date: Fri, 02 May 2008 22:21:04 GMT
"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
.
- References:
- program bug
- From: Bill Cunningham
- Re: program bug
- From: Robert Gamble
- program bug
- Prev by Date: Re: Example of the optimiser recognising a pattern
- Next by Date: Re: program bug
- Previous by thread: Re: program bug
- Next by thread: Re: program bug
- Index(es):
Relevant Pages
|