S
S
sddvxd2018-12-15 14:50:04
C++ / C#
sddvxd, 2018-12-15 14:50:04

Why not change the line?

Good afternoon!
Why does this cause a Segmantation fault?

char* str = "original";
    str[0] = 'a';

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Gornostaev, 2018-12-15
@sddvxd

Memory for string characters is allocated in a write-protected area. Literals are constants.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question