Extension of first:he "help"
andre
andre at targon.UUCP
Tue Sep 27 02:17:06 AEST 1988
In article <9600002 at silver> mitchemt at silver.bacs.indiana.edu writes:
>
>This is an extension of the first note I sent. I need to find out what is wrong with the program listed in the note "Help" from mitchemt. I get the following
>errors:
>
>line 13: warning: illegal combination of pointer and integer, operation =
You didn't give a prototype of the function newstrel, so it will be seen
as an integer function, the default. To fix this you should put a line like
STRING *newstrel();
before main.
>line 19: redeclaration of newstrel
The compiler thought it was an integer functions and now you tell it
otherwise.
>line 22: warning: illegal combination of pointer and integer, op RETURN
Same as previuos problem.
If you change this the program has another bug: the argument to newstrel is
a STRING *, and not a STRING **. The function first assinges the pointer
to where your argument poins to, probably infinity. On very tolerant systems
the assignment in main will correct this if you didn't hit your text-space
:-).
the solution is to get rid of the argument new-pointer = newstrel();
or to make the argument a STRING **;
(void) newstrel(&new-pointer);
STRING *newstrel (ptr)
STRING **ptr;
{
*ptr = malloc....
return *ptr;
}
~----~ |m AAA DDDD It's not the kill, but the thrill of the chase.
~|d1|~@-- AA AAvv vvDD DD Segment registers are for worms.
~----~ & AAAAAAAvv vvDD DD
~~~~~~ -- AAA AAAvvvDDDDDD Andre van Dalen, uunet!mcvax!targon!andre
--
~----~ |m AAA DDDD It's not the kill, but the thrill of the chase.
~|d1|~@-- AA AAvv vvDD DD Segment registers are for worms.
~----~ & AAAAAAAvv vvDD DD
~~~~~~ -- AAA AAAvvvDDDDDD Andre van Dalen, uunet!mcvax!targon!andre
More information about the Comp.lang.c
mailing list