| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | character arrays tha |
George White wrote in a message to William Mcbrine:
WM> DC> static char *books[30] = {"moby dick",
"annie", etc};
WM>That's an array of pointers to constant strings. You can't read into it.
Correct.
GW> That is an initialised array of strings of varying length
No, the right to left rule says:
books is an array (size 30) of pointers to char, with static qualifier
GW> You _can_ write to them, but it's a dangerous occupation since they
GW> have the length of the string they were initialised with and so
GW> vary in length.
Writing to string literals, even without overwriting their bounds, will
fail miserably on many systems, even on plain DOS compilers when for
example the 'merge duplicate strings' or similar option is enabled.
greetings,
Tom
tomtorfs{at}village.uunet.be
--- timEd/2 1.10.y2k+
* Origin: 80X86 BBS 32-15-24.62.32 V.34/V.FC (24h/24h) (2:292/516)SEEN-BY: 396/1 632/0 371 633/260 267 270 371 634/397 635/506 728 639/252 SEEN-BY: 670/218 @PATH: 292/516 106/1 396/1 633/260 635/506 728 633/267 |
|
| SOURCE: echomail via fidonet.ozzmosis.com | |
Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.