function prototype problem

K.LAUX rkl1 at hound.UUCP
Wed Nov 16 03:06:55 AEST 1988


In article <310 at drd.UUCP>, mark at drd.UUCP (Mark Lawrence) writes:
| I compile the following code fragment:
| --
| #include <stdio.h>
| 
| char *rpeet  ( short, char );
| char rpeet_temp[81];
| 
| char *rpeet ( num, ch )
|     short num;
|     char ch;
| {
|   int  i;
| 
|   memset( rpeet_temp, ch, num );
			^^  ^^^		<--***NOTE***
|   rpeet_temp[num] = '\0';
|   return( rpeet_temp );
| }
| --
| and get the following gripe from my compiler (gcc 1.30):
| 
| rpeet.c: In function rpeet:
| rpeet.c:9: argument `num' doesn't match function prototype
| rpeet.c:9: argument `ch' doesn't match function prototype
| 

	I don't think the compiler is complaining at all about the function
prototype for rpeet;  it's complaining about the call to MEMSET.

	The function prototype for memset () is:

	void *memset (void *dest, int c, size_t count);
				  ^^^    ^^^^^^

	and neither 'num' nor 'ch' is of the proper type.

--rkl



More information about the Comp.lang.c mailing list