pointer <==> *pointer ??

bill bill at uoregon.UUCP
Mon Oct 15 14:10:00 AEST 1984


[this line intentionally left blank]

For those who are amused by C quirks:

While attempting to fix a program bug, I changed the code from 
arragement A to arrangement B (below).

--- A ---

char strings[SIZE1][SIZE2];

teststr(str)
char *str;
{
	register char (*b)[SIZE2] = strings;

	while (b < &strings[SIZE1]) {
		if (strcmp(str, b) == 0)
			break;
		b++;
	.
	.
	.
}

--- B ---

char strings[SIZE1][SIZE2];

teststr(str)
char *str;
{
	register char (*b)[SIZE2] = strings;

	while (b < &strings[SIZE1]) {
		if (strcmp(str, *b) == 0)
			break;
		b++;
	.
	.
	.
}

The result, of course, is that nothing changes.

	Randy Goodall, Perfect Software, Inc. (courtesy bill)

	{tektronix,hpcvra,hp-pcd}!uoregon!bill
/* ---------- */



More information about the Comp.unix.wizards mailing list