Address of array

Chris Torek chris at umcp-cs.UUCP
Wed Mar 26 07:18:19 AEST 1986


In article <2377 at utcsri.UUCP> greg at utcsri.UUCP (Gregory Smith) writes:

>	char *char_ptr, (*char_ar_ptr)[80];

>	++ char_ptr;	/* add 1 to the actual value of char_ptr */
>	++ char_ar_ptr; /* add _80_ to the actual value of char_ar_ptr */
>			/* i.e. point to the next array in a list */

Yes.

>	char line[80];	/* this is what I want to point it at */

>	char_ar_ptr = &line;		/* this should work ... */

Debatable.

This works, and is probably even what you `really' mean:

	#define N	2	/* e.g. */
	char lines[N][80];

	char_ar_ptr = lines;

If you only have one line, why do you need to point at a set of
lines?
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 1415)
UUCP:	seismo!umcp-cs!chris
CSNet:	chris at umcp-cs		ARPA:	chris at mimsy.umd.edu



More information about the Comp.lang.c mailing list