can someone help knowing the difference between
char *st="myname"; char st="myname";
i know they both is array of charachers but the difference when dealing with them and how they are in memory ?
> Never assign raw data directly to an uninitialised pointer. If done so, where would the pointer point to? Where will the raw data be stored? Maybe it will compile, maybe it won't. Maybe it could lead to disastrous effects. You have to make sure a pointer points to something … Read More
Some compilers will bitch at you if you try to assign a string literal to a `char*` (often depending upon how you set the strictness level of type-checking for the compiler). You SHOULD use a `const char*` instead in such cases. The first case is a clear violation of intentional … Read More
> can someone help knowing the difference between > char *st="myname"; > char st="myname"; `"myname"` is a narrow string literal; in C++, A narrow string literal has type “**array of n const char**”, where n is the size of the string as defined below, and has static storage duration. - … Read More
Edited by tapananand
Edited by vijayan121