diff --git a/source/_posts/c.md b/source/_posts/c.md index 0910149..15ed16a 100644 --- a/source/_posts/c.md +++ b/source/_posts/c.md @@ -185,6 +185,14 @@ printf("%s", greetings); // print "Hell!" ``` +Creating String using character pointer (String Literals) +```c +char *greetings = "Hello"; +printf("%s", greetings); +// print "Hello!" +``` +**NOTE**: String literals might be stored in read-only section of memory. Modifying a string literal invokes undefined behavior. You can't modify it.! + `C` **does not** have a String type, use `char` type and create an `array` of characters