D
dattts
what is the difference between a single character and a string
consisting only one character
consisting only one character
what is the difference between a single character and a string
consisting only one character
santosh said:what is the difference between a single character and a string
consisting only one character
Try this program:
#include <stdio.h>
int main(void) {
char c0 = '0';
char c1[] = "0";
printf("Size of c0 is %u\nSize of c1 is %u\n", sizeof c0, sizeof
c1); return 0;
}
What is the output and why are the sizes for 'c0' and 'c1' different?
What does your C textbook say?
And try this one too:
#include <stdio.h>
int main(void) {
printf("Size of 'a' is %u\nSize of \"a\" is %u\n",
sizeof 'a', sizeof "a");
return 0;
}
What is the output and why are they different for 'a' and "a"?
What does you textbook say about this?
what is the difference between a single character and a string
consisting only one character
what is the difference between a single character and a string
consisting only one character
Try this program:
#include <stdio.h>
int main(void) {
char c0 = '0';
char c1[] = "0";
what is the difference between a single character and a string
consisting only one character
Try this program:
#include <stdio.h>
int main(void) {
char c0 = '0';
char c1[] = "0";
This string "0" consists of two characters. The only string that
consists of a single char is "".
[email protected] said:what is the difference between a single character and a string
consisting only one character
[email protected] said:This string "0" consists of two characters.
what is the difference between a single character and a string
consisting only one character
The nul terminator isn't one of the characters "in" a string.
Chris said:The nul terminator isn't one of the X-Mozilla-Status: 0009ng.
what is the difference between a single character and a string
consisting only one character
But it IS one of the characters in the char array holding the
string.
Chris said:Urm -- what happened there?
Oh, yes.
Elsethread $)CHarald van D )& k <[email protected]> (and
what happened /there/? Is my newsgarbler doing something
odd to names & content?) remarks
| From a standards perspective:
| A string is defined as "a contiguous sequence of characters
| terminated by and including the first null character".
which would make my position unsupported by the Standard's
terminology.
Harald van D?k said:Does it display better like this?
Harald said:Does it display better like this?
No. His name appears mangled on my newsserver/newsreader too. I suspect
that he is using an encoding not supported by some software in the
Usenet hierarchy.
It was fine when Harald started posting to this group, but for a few
months now, his name has not been displayed properly.
Does it display better like this?
Apparently KNode encoded my name in utf-8, but Pan encodes it in
iso-2022-kr. I'll check if there's an option to change that.
santosh said:Yes. It is now displayed correctly.
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.