int main() {          char* string = &quot;Hello world&quot;;         string[2] = 'd';          printf(&quot;%s\n&quot;, string);          return 0; }     int main() {          time_t now;         time(&amp;now);                                                                                             $                 char* time = ctime(&amp;now) + 11;         time[8] = '\0';                                                                               printf(&quot;%s\n&quot;, time);          return 0; }  Like in the second example I am able to modify a particular index of the array for the pointer to terminate the string with the NULL character. However, with the first one I just try to change the character at index 2 to the letter 'd' but it refuses to print the output and I a Segmentation fault error! My guess is that in the second one there is some very slight difference where the ampersand is used to get the contents of the address in memory to where the pointer points to but that's just my guess. Would love if someone could give me a clear and not overly confusing explanation as to why this is... Thanks!
The following code receives seg fault on line 2:  char *str = "string"; str[0] = 'z';  // could be also written as *str = 'z' printf("%s\n", str);   While this works perfectly well:  char str[] = "string"; str[0] = 'z'; printf("%s\n", str);   Tested with MSVC and GCC.
Find a file when you know its checksum? How can I enable Hardmode? What items do I need to make my world Hard Mode? How to know current name of the database in Django? "Fatal error: Cannot redeclare " PDF of product of variables Could anyone please indicate a general strategy (if there is any) to get the PDF (or CDF) of the  product of two random variables, each having known distributions and limits?   My particular need is the following: Let $w :=u \cdot v$. The PDF of $u$ is $$\frac{1}{\pi u}\frac{1}{\sqrt{u^2-0.25}},$$ for $z&gt;0.5$ and the PDF of $v$ is $$\exp\left(-\frac{v}{v_0}\right),$$ for $v_1&lt;v&lt;v_2$. What's the PDF of $w$? What defines the upper limit for speed of Subspace Communications? mentions there to be a definite upper limit as to the speed of Subspace Communications. Is the reason for this ever touched on in any of the Star Trek media (Canon or not) or is it "speed of plot"? This  would suggest speed of plot but I'm curious what would provide an upper limit if light doesn't? Show that $S = \sqrt{S^2}$ is a biased estimator of $\sigma$ given a random sample from a normal distribution ... Suppose $Y_1, \ldots, Y_n$ is a random sample from a normal distribution with mean $\mu$ and variance $\sigma^2$. Let $S^2$ be the sample variance, which is unbiased for $\sigma^2$.  GOAL: Show that $S = \sqrt{S^2}$ is a biased estimator of $\sigma$.  I realize that $(n-1)S^2/ \sigma ^2$ is chi-square with $(n-1)$ degrees of freedom.  I am given that $$E(S) = E\left[\frac{\sigma}{\sqrt{n-1}} \left[\frac{(n-1)S^2}{\sigma^2}\right]^{1/2}\right] = \frac{\sigma}{\sqrt{n-1}} \int_0^\infty v^{1/2} \frac{1}{\Gamma[(n-1)/2] 2^{(n-1)/2}} v^{(n-1)/2} e^{-v/2} \, dv$$  Can anyone help me understand why they have $v^{1/2}$ and $v^{(n-1)/2}$ (combining them $v^{n/2}$ as I think it should be $v^{1/2}$ and $v^{\frac{(n-1)}{2}-1}$ (combining both terms give $v^{(n-2)/2}$ since the pdf for chi-square distribution is $$ f(v) = \frac{v^{(x/2)-1} e^{-v/2}}{2^{x/2}\Gamma(x/2)},$$ where $x$ is degree of freedom?  Could anyone please tell me which one is the correct answer with explanation?  Thank you Why isn't dark matter just ordinary matter? There's more gravitational force in our galaxy (and others) than can be explained by counting stars made of ordinary matter. So why not lots of dark planetary systems (i.e., without stars) made of ordinary matter? Why must we assume some undiscovered and unexplained form of matter? Modular exponentiation by repeated squaring Is it possible to run two windows sessions from the same computer at the same time? A friend asked me if it is possible to have two screen/keyboards/mouse connected to one computer, and allowing two users to use the computer as if they where using two different computers (one sessions for each input/output)  Is it possible? Compile and install rtl8192cu driver Can someone help me with this problem ? I am new to Linux, so I do not know commands and I never did something like installing or compiling with command-line.  I bought WiFi adapter from Edimax, model EW-7811UN for my PC (not laptop, so I do not have wifi card, only ethernet). When I go through guide on CD, I came across a version of kernel. It said I need version 2.6, but I have 3.5.0-22-generic.   I got errors like I do not have file or folder etc. Can someone tell me where I can download compiled driver and where I need to put it? Or some other advice. I don't want downgrade kernel when it is not necessary. How to get a cross-origin resource sharing (CORS) post request working Transit Visa for Thailand $\|h(x)-h(y)\|\geq 3\|x-y\|$ prove that image of open is open Several years ago I heard of something called dummy subjects in high school. It was then stated that, for example, it is a dummy subject when it starts many instances of sentences, e.g.        It is rainy today.   It is hard to imagine how hard is to live alone.   It is not my university degree that matters here.     My question is if we can use it with plural subjects? For example in       If some think that in Mahmoud Dowlatabadi’s works it is only social themes that matter and the writer is ignoring fictional arrays and artistic techniques, at least, endings of his stories show wrongness of this idea.     My question deals with the italicized part. If this usage is OK, can we also write they are social themes that matter? I mean can they also play the role of a dummy subject? Was the singularity at Big Bang perfectly uniform and if so, why did the universe lose its uniformity? How to connect to a MS Access file (mdb) using C#? How can I delete my printer from Ubuntu? Using 12.04 my printer a canon ip2600 will not print.   SystemSettings/printers shows it as installed, connected to local host, enabled, accepting jobs, shared and allowing printing for everyone. Yet it does not print.   I have tried to remove it but get a request for user name and password which I enter (I only have one password) but the password is listed as incorrect.   I need a sudo command which I can use to delete the printer so I can attempt to re-install it. As it is the printer is useless and I can not even uninstall it. Skewness, kurtosis and how many standard deviations values are from the mean As is well known for the normal distribution, 68% of the probability mass is within one standard deviation of the mean, 95% within two standard deviations and 99.7% within 3 standard deviations.   However, I have some empirical distributions that are leptokurtic and negatively skewed. In such circumstances is there a formula based on their higher-order moments to calculate how much of the probability mass is within so many standard deviations of the mean?   I have a measurement and would like to give some sense of how far it is from the midpoint (mean or some other measure of central tendency).  Can this be done? Does it matter what I choose for serialVersionUID when extending Serializable classes in Java?