Reputation: 4190
What is the difference between the following?
char input[] = {"abc"};
and
char input[] = "abc";
Upvotes: 14
Views: 262
Reputation: 145899
Both forms are equivalent and permitted.
char input[] = "abc";
or
char input[] = {"abc"};
Here is the relevant paragraph from the C Standard:
(C99, 6.7.8p14): "An array of character type may be initialized by a character string literal, optionally enclosed in braces"
Upvotes: 23