Re: char* argv[]
- From: Richard Heathfield <rjh@xxxxxxxxxxxxxxx>
- Date: Wed, 19 Dec 2007 07:36:46 +0000
William Pursell said:
On Dec 14, 11:30 pm, Richard Heathfield <r...@xxxxxxxxxxxxxxx> wrote:
Logan said:
<snip>int main(int argc, char *argv) {
Your second program thinks argv is a string, which it isn't.
No.
Your "correction" is incorrect.
In the second program, argv is a pointer to
an array of characters.
No, in the second program argv is (incorrectly defined as) a pointer to the
*first element* in an array of characters. The program then uses this
value as an argument matching a printf %s format specifier - in other
words, the program thinks argv is a string (just as I claimed), and is
using it as one.
C doesn't have a string type.
Non sequitur. I didn't claim that C has a string type.
--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
.
- Follow-Ups:
- Re: char* argv[]
- From: William Pursell
- Re: char* argv[]
- From: Keith Thompson
- Re: char* argv[]
- References:
- char* argv[]
- From: Logan
- Re: char* argv[]
- From: Richard Heathfield
- Re: char* argv[]
- From: William Pursell
- char* argv[]
- Prev by Date: Re: object file size is reduced after build
- Next by Date: Re: Positive random number
- Previous by thread: Re: char* argv[]
- Next by thread: Re: char* argv[]
- Index(es):
Relevant Pages
|
|