#String literals & character arrays
19 messages · Page 1 of 1 (latest)
When your question is answered use !solved to mark the question as resolved.
Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question use !howto ask.
I think it's the extra conversion step that C won't do to convert string literals to char arrays, and then characters to ASCII equivalents when assigning to an integer array.
because the types are fundamentally different. string literals are char arrays, you can't use it to initialize an array of different type
but this works {'a', 'v', 'q'} ?
because that's an initializer for an int array
those character literals have type int
oh
that makes sense
so this won't work right?
char buffer[] = {'a', 'b'};
int bugger[] = buffer;
I mean this is what I'm essentially trying to do with the string literal except it has a null character at the end
string literals already have null terminators