Message from C, C++ talks

June 2019

— Are u really trying on compiler or not

— Now you are trying to assign the POINTER different value, and not copying the string. You cannot copy strings with = in C

Message permanent page

— This is correct.. the mistake is the line 9 only

— You should really learn the basics


There’s no built-in string type in C while other languages like Java and Python do, char* is literally a pointer to char

— Please teach me then...

— If you pay me $40 per hour I will do it

— Hahaha.... very funny

— So something like str1 = str2 is just making str1 points to str2

— It's not a joke though lol

— Yes

— And if str2 gets freed, trying to print str1 will segfault

— You’re not changing the actualy string content, it’s still there, where str1 was pointing at

— That is also correct

— /warn read the rules please