C – String Constant 2017-08-05T14:28:36+00:00

String Constants :

A string constant consists of zero or more character enclosed in quotation marks. Several string constants are given below.

“Welcome to C Programming”                      “ ”

“a+b\n”                                                          “Error\a\a\a”

There is a difference between the constant ‘A’ and “A” in C, the first ‘A’ is a character constant while the second “A” is string constant. The notation ‘A’ is a constant occupying a single byte containing the ASCII code of the character A. The notation  “A”  on the other hand ,is a constant that occupies two bytes one for ASCII code of A and another for the null character with the value 0,that terminates all the string.


Output :

Value of a = Welcome to C Programming

Prev Next