A
alex
what data type is a line like this:
"adslfkj adsfjk adf"
"adslfkj adsfjk adf"
what data type is a line like this:
"adslfkj adsfjk adf"
* "alex said:what data type is a line like this:
"adslfkj adsfjk adf"
JKop said:alex posted:
It's an expression of type char* , which points to the first in an array of
characters.
-JKop
Alf P. Steinbach said:It is an array of n constant chars. Which in some but not all contexts
decays to a pointer to constant char. And in some but not all contexts,
as backward compatibility with C, decays to pointer to plain char.
--
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
alex said:what data type is a line like this:
"adslfkj adsfjk adf"
JKop said:alex posted:
It's an expression of type char* , which points to the first in an
array of characters.
No. It's of type array of const char with 19 elements.
You can see the difference if you look at sizeof(char*) vs.
sizeof("adslfkj adsfjk adf").
of:JKop said:void Chocolate(char monkey[19])
{
;
}
void Chocolate(char* monkey)
{
;
}
int main(void)
{
Chocolate("adslfkj adsfjk adf");
return 0;
}
If char* and char[19] are two different types, why they hell won't the
above compile! I wish C++ would make it's mind up and determine the type
JKop said:Rolf Magnus posted:
No. It's of type array of const char with 19 elements.
You can see the difference if you look at sizeof(char*) vs.
sizeof("adslfkj adsfjk adf").
Seeing as you are right, look at this.
void Chocolate(char monkey[19])
{
;
}
void Chocolate(char* monkey)
{
;
}
int main(void)
{
Chocolate("adslfkj adsfjk adf");
return 0;
}
If char* and char[19] are two different types, why they hell
won't the above compile!
I wish C++ would make it's mind up and determine the type of:
"adslfkj adsfjk adf"
...How does sizeof() work? Does it generate a figure based upon the
type of the object passed to it?
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.