(08-31-2022, 05:10 PM)Kernelpanic Wrote:Quote:As I've tried to explain, quoted character strings can only be accessed via <column>.
That's just wrong! The names in the example are accessed through the row.
Nothing wrong about it, except that it could have been written better. The line you attacked should have read:
Quote:quoted character strings can be directly accessed only via <column>.
Still apples vs oranges. I see where your confusion comes from. I freely admit to being a lousy teacher. I have neither the communication skills nor the patience, so my explanations probably weren't thorough enough.
While your example creates character arrays, you are using string literals as array initializers.
The subject was about how strings were indexed directly by an existing program, NOT about how someone else might use strings in a new program.
I was explaining how string literals, which the compiler treats as character arrays, may be accessed DIRECTLY as arrays. The subject was NOT about accessing arrays declared by the programmer. While string literals can be used to initialize programmer-defined arrays, that was not the subject.
My posts have not been about alternative ways of accessing string data, because that would confuse things even more. Alternatives would be off-topic. My posts have been STRICTLY about how one particular program was designed to access string data. Period.
This was the subject:
c="this"[3];
/* Nothing wrong with this */
not this:
char s[]="this";
...
c=s[3];
/* This is not the subject under discussion */
( @Spriggsy : I envy you. Enjoy the show!)