linux-c-programming.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* const char * vs char[]
@ 2004-03-23 12:01 Massimiliano Cialdi
  2004-03-23 12:19 ` Glynn Clements
  2004-03-23 13:44 ` Mariano Moreyra
  0 siblings, 2 replies; 8+ messages in thread
From: Massimiliano Cialdi @ 2004-03-23 12:01 UTC (permalink / raw)
  To: linux-c-programming

I have this:

#include <stdio.h>
const char *str = "pippo";
int main(void)
{
  void stampa(char s[]);
  stampa(str);
  return 0;
}
void stampa(char s[])
{
 printf("%s\n", s);
}

and gcc gives me a warning:
pippo.c:9: warning: passing arg 1 of `stampa' discards qualifiers from
pointer target type


what are the differences between char[] and const char *?

thanks

-- 
Massimiliano Cialdi
cialdi@firenze.net
m.cialdi@oksys.it

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2004-03-23 20:37 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-03-23 12:01 const char * vs char[] Massimiliano Cialdi
2004-03-23 12:19 ` Glynn Clements
2004-03-23 13:44 ` Mariano Moreyra
2004-03-23 14:19   ` Massimiliano Cialdi
2004-03-23 14:52     ` Mariano Moreyra
2004-03-23 17:04       ` Jan-Benedict Glaw
2004-03-23 20:26         ` Glynn Clements
2004-03-23 20:37       ` Glynn Clements

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).