Re: char* argv[]
- From: Richard Heathfield <rjh@xxxxxxxxxxxxxxx>
- Date: Wed, 19 Dec 2007 19:44:39 +0000
William Pursell said:
<snip>
A pointer to an array of characters is a pointer to
the first element.
No, it isn't; they have different types, as this program will demonstrate.
#include <stdio.h>
int main(void)
{
char arr[13] = "Hello, world"; /* array of characters */
char (*parr)[13] = &arr; /* pointer to array of characters */
char *pch = arr; /* ptr to first element, eqvt to &arr[0] */
printf("%lu\n", (unsigned long)sizeof *parr);
printf("%lu\n", (unsigned long)sizeof *pch);
return 0;
}
--
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
.
- References:
- char* argv[]
- From: Logan
- Re: char* argv[]
- From: Richard Heathfield
- Re: char* argv[]
- From: William Pursell
- Re: char* argv[]
- From: Richard Heathfield
- Re: char* argv[]
- From: William Pursell
- char* argv[]
- Prev by Date: Re: char* argv[]
- Next by Date: Re: Positive random number
- Previous by thread: Re: char* argv[]
- Next by thread: Re: char* argv[]
- Index(es):
Relevant Pages
|