C
Chris Dollin
arnuld said:void print_line( const char* line )
{
while( *line != '\0')
{
puts(*line++);
}
}
================ OUTPUT =======================
[arnuld@raj C]$ gcc -ansi -pedantic -Wall -Wextra 7-6.c
7-6.c: In function `print_line':
7-6.c:96: warning: passing arg 1 of `puts' makes pointer from integer
without a cast
[arnuld@raj C]$ ./a.out 7-6.c replace-blanks.c Segmentationfault
[arnuld@raj C]$
Ask yourself: what does `puts` accept as an parameter? What is
the type of the expression `*line++`? Are C characters a kind
of integer? Do you really expect an integer to be freely and
automatically converted to an integer?
--
"It took a very long time, much longer than the most /Sector General/
generous estimates."
Hewlett-Packard Limited Cain Road, Bracknell, registered no:
registered office: Berks RG12 1HN 690597 England