From: Massimiliano Cialdi <cialdi@firenze.net>
To: linux-c-programming <linux-c-programming@vger.kernel.org>
Subject: const char * vs char[]
Date: Tue, 23 Mar 2004 13:01:18 +0100 [thread overview]
Message-ID: <20040323130118.00005637.cialdi@firenze.net> (raw)
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
next reply other threads:[~2004-03-23 12:01 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-03-23 12:01 Massimiliano Cialdi [this message]
2004-03-23 12:19 ` const char * vs char[] 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20040323130118.00005637.cialdi@firenze.net \
--to=cialdi@firenze.net \
--cc=linux-c-programming@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).