mirror of
https://github.com/Fechin/reference.git
synced 2026-11-21 13:34:06 +03:00
1 file changed
+8
@@ -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
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user