confusion with char *a and char a[NUM]

Barry Margolin barmar at think.com
Tue Dec 4 07:25:20 AEST 1990


In article <7656 at umd5.umd.edu> jjk at astro.umd.edu( Jim Klavetter) writes:
>However, if I have
>	a=strchr(string, ":");
>I get the error message
>	121: incompatible types in assignment
>or some such thing (that one is from gcc).

Doug Gwyn already answered most of your questions, but he missed on problem
with the above expression.  The second argument to strchr() is supposed to
be an int (according to the SunOS manual, but maybe ANSI says "char"), not
a char*.  Therefore, it should be

	a = strchr (string, ':');
--
Barry Margolin, Thinking Machines Corp.

barmar at think.com
{uunet,harvard}!think!barmar



More information about the Comp.lang.c mailing list