D
D
dandropov952018-08-24 17:40:11
C++ / C#
dandropov95, 2018-08-24 17:40:11

How is a constant string stored in C?

The book says that a string constant is stored as static. But I didn't quite understand this thread. Tell me what exactly is said in this block of text. It is not clear what exactly is meant by using a string in a function and storing it only once. Can you provide some code example to explain this idea.
5b8017f06cff7290898074.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
GavriKos, 2018-08-24
@GavriKos

Even if you create a string constant INSIDE the function, something like this: The
memory will be allocated once and will then always be reused, no matter how many times you call the function.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question