What is the difference between a String Constant and String Literal in C?

Dave picture Dave · Oct 12, 2010 · Viewed 7.4k times · Source

What's the difference between a String Constant and String Literal in plain C?

This question is similar to another: What's the difference between a string constant and a string literal? ...except that one was regarding Objective-C (using NSString) and not C.

Answer

user166390 picture user166390 · Oct 12, 2010

In the C99 Draft from 2007 the term sting literal is used. The term string constant does not appear in the draft at all.

I find string literal to be a good term choice when talking about "foo" (just as 42 is a literal number, "foo" is a literal string).