Inconsistent gcc diagnostic for string initialization
While: char a[5] = {‘h’,’e’,’l’,’l’,’o’,’\0′}; is invalid. (C11, 6.7.9p2) “No initializer shall attempt to provide a value for an object not contained within the entity being initialized.” This: char b[5] = “hello”; is explicitly allowed by C (emphasis mine): (C11, 6.7.9p14) “An array of character type may be initialized by a character string literal or … Read more