Bus error using char arrays in c I am trying to teach myself C language. My transition from C has been rough so far. I am doing a problem from the Book "Intro to C language" and there is a problem that should read a line from the user and then ask the user for an int. My job was to find that particular word corresponding to the int.   Example     Hello World, How are you all doing. // This is the line being read      2 // the word to be printed to the console   Expected Output     World   Below is a snippet of my code that i think is giving me the bus error.   void corrspndToInt (char *theLine, int word, char *result ) {      int start;     int end;     int spaces = 1;     result = "";      //int i;      //search for the nth non-blank character      for(start = 0; start &lt; strlen(theLine) &amp;&amp; (spaces &lt; word); start++ ) {          if( isspace ( theLine[ start ] ) ) {              spaces++;         } // end if      } // end for loop      //only need to continue if we haven't gone past the end of the string      if( start &lt; strlen(theLine) ) {          //the next blank character is the end          for ( end = start; end &lt; strlen(theLine) &amp;&amp; ( !isspace ( theLine[ end ] ) ) ; end++ ) {          ;          } // end for loop          //we now have the word          result = strncpy ( result, theLine+start, end - start);        } // end if  }   This is how i am printing the result in main function.  printf("%s\n", result );   Now that i have been teaching C language to myself and through SO i learned that returning char arrays should not be done. There were two methods dynamic allocation using function malloc and there was another method which is the one i implemented in my code. I have checked my other method and there seems to be nothing wrong with that. The problem here is with this method as it is not getting the correct word.  I have been trying to debug my program but apparently Mac doesn't accept the gdb command. I have installed the command line tools and everything else but it still says      Command not found   Can anyone please guide me in the right direction here? I have been overthinking this problem from the last 1 hour now.
Why do I get a segmentation fault when writing to a "char *s" initialized with a string literal, but not "char s[]"? 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.
Unknown Additional Driver: Processor microcode firmware for Intel CPUs for intel-microcode After upgrading to 15.04, I have one additional driver (it did not appear in 14.10). What is the purpose of this driver and should I enable it? In a group $G$, if for all $a,b,c\in G$, $ab=ca\Rightarrow b=c$, then $G$ is abelian Let $G$ be a group. If for all $a,b,c\in G$, $ab=ca\Rightarrow b=c$, then phow can I prove that  $G$ is abelian? I want to do an , then cross-validate model prediction accuracy with 80% data for training and 20% for validation, and calculate  for predictions.  Consider this dataset:    X     Y ----------  2.3    1  3.1    2  3.5    2  10.0   5  6.8    4  5.0    3  5.4    2  3.2    1   I did this:  x=c(2.3,3.1,3.5,10.0,6.8,5.0,5.4,3.2) y=c(1,2,2,5,4,3,2,1) myData=data.frame(cbind(x,y))  library("MASS") reg=polr(as.factor(myData$y)~myData$x,data=myData,method="probit")   I saw , but I couldn't fully understand. Suppose myValidationData contains 20% of data which I want to use for validation. So, I would do:  fit=predict(reg,type="probs") x=c(5.6, 5.1) y=c(3,3) myValidationData=data.frame(cbind(x,y))   This is how I tried to predict, but is it correct, when I want to cross-validate?  fit=predict(reg,data=myValidationData,type="probs")   How should I measure RMSE? And, how can I plot the prediction? How to get a list of applications installed in Ubuntu dash? In Gnome, we have applications grouped up based on their type (like - games, accessories, et al). But in Unity, we need to manually type in the Unity to get the App.  Is there any keyword/utility to display the applications in GUI?  Ubuntu Version : 14.04 Hardware : Dell Inspiron 3437 Sort an array without rewriting a key Get rid of the question ban on Meta; suspend actively harmful users manually appears to have been question banned because of two unpopular Meta suggestions. (He says so in )  Look at the two contributions that appear to have gotten him banned. Like those of many others, they may not be of perfect quality, but they are not actively harmful to the site, either. As it stands, you can get question blocked on Meta simply for asking questions that aren't popular with the Meta crowd.  Why does the team insist on keeping the question ban active on Meta?  Why can't real problem users be dealt with through manual moderator action? Don't tell me it's a problem of scale; as far as I can see, actually toxic users are very rare on Meta.  People will frequently complain that Meta actively discourages the expression of unpopular viewpoints and suggestions. With the threat of question bans in place, I find those complaints difficult to refute. I hate that. How to install with Wubi when it says "Could not retrieve the required disk image files"? I'm reading Baby Rudin and exercise 28 of chapter 2 reads "Prove that every closed set in a separable metric space is the union of a (possibly empty) perfect set and a set which is at most countable." I don't understand why the set must be closed in order for this to be true.  My proof is as follows, and I don't make any reference to the closedness of the set:  Let $E$ be a set in a separable metric space.  Let $B$ be a countable base of that metric space.  Let $P$ be the set of condensation points of $E$.  I claim that $P$ is perfect and $E-P$ is at most countable.  If $p$ is a limit point of $P$, then every neighborhood of $p$ includes at least one point $q$ of P.  For a neighborhood $N_{p}$ of $p$, choose a neighborhood $N_{q} \subset N_{p}$ of $q$.  Since $q$ is a condensation point of $E$, uncountably many points of $E$ are in $N_{q}$, and thus in $N_{p}$.  So $p\in P$ and $P$ is closed.  If $p \in P$, then $p$ is a condensation point of $E$, so every neighborhood $N_{p}$ of $p$ must include uncountably many points of $E$.  If $p$ is not a limit point of $P$, then there exists a neighborhood $N_{p}$ of $p$ such that $N_p$ includes no condensation points of $E$ except for $p$.  This means that every point $q\in N_{p}-\{p\}$ must have a neighborhood $N_{q}$ that does not have uncountably many points of $E$.  For each $b_{k}\in B \cap \mathscr{P}(N_{p})$, choose such a neighborhood $N_{q_{k}} \supset b_{k}$ of some point $q\in N_{p}-\{p\}$.  Now $\{N_{q_{k}}\}$ covers $N_{p}$, and $\bigcup_{k=1}^{\infty}N_{q_{k}}\supset N_{p}$ has at most countably many points of $E$, for it is a union of countably many sets that have at most countably many points of $E$.  This contradicts the assumption that $p\in P$.  So $P$ is perfect.  Let $S=E-P$. There are no condensation points in $S$.  So there exists an open cover $\{N_s\}$, where each $N_s$ is a neighborhood of $s \in S$ with at most countably many elements of $S$. For each $b_{k}\in B \cap \mathscr{P}(S)$, choose such a neighborhood $N_{s_{k}} \supset b_{k}$ of some point $s\in S$.  Then we have a countable subcover $\{N_{p_{k}}\}$ of $S$. As $N_{p_{k}} \cap S$ is at most countable for all $k$, $S$ must be at most countable.  So what am I doing wrong?  Or is Rudin's assumption of closedness extraneous? Possible Duplicate:          There are several tarballs (e.g. Firefox, Eclipse, Zend Studio and ...) that have executable files in them, that we can extract and run. but this executable will be available only for the user that extracts it.  If we want to make it available for all users we should move it to some location like /usr/share, /usr/local/share/, /opt/, ... and give appropriate permissions, make an executable file in /usr/bin/ and so on...  I want to make a deb installer file that does them all! How to do it? The square root of a prime number is irrational I've been learning about Galois theory recently on my own, and I've been trying to solve tests from my university. Even though I understand all the theorems, I  seem to be having some trouble with the technical stuff. A specific example would be how to find the Galois group of a given polynomial. I know some tricks, and I manage to solve some of those questions, but some not.  For example, one of the tests asks to find the Galois group of $x^{4}-4x+2$.  I can see that it is irreducible over $\mathbb Q$ (Eisenstein), but I have no clue as to how to find its Galois group over $\mathbb Q$. Can someone tell me how to do this? General techniques concerning this sort of problems are also welcome :).  Thanks! Triangle Inequality of the Cartesian product with Max function Let $(X,d)$ be a metric space.  Define $$d'((x,y),(z,w))=max\{d(x,z),d(y,w)\}.$$   I'm trying to prove the triangle inequality for this, but really don't have a clue how.  Any tips or suggestions would be greatly appreciated! Given that , I wonder if every intelligent biological species is capable of producing beings that are Force-Sensitive?   Or are there some species characteristics that can make it 100% impossible for them ever to produce a Force-sensitive individual.  NOTE: Let's exclude - if they exist in EU - things like random new-species-creating mutations - e.g. the individual should be 100% the same species, able to interbreed. E: Package 'guile-1.8-dev' has no installation candidate this is an error i got I have apt-get 0.7.23.1 on host machine. I do not have root, thus not able to update it, or install other packages.  I want to download .deb packages with it, but neither  apt-get -d bash   (Invalid operation bash)  nor  apt-get -d install bash   (do not have root)  work.  On my home machine with a newer version of apt-get I can  apt-get download bash   and it does exactly what I want it to.  How can I perform the same on the host machine? I've set up the physics of a swinging wrecking ball and set the animation to run for 240 frames.  This was not long enough for the entire "swing" of the ball-and-chain.   I'm unable to reset the timeline, but I can set the end frame to (say) 1000 frames, but when I try to play the animation, the animation progress halts at frame 240 and I cannot get it to go any further.   There are no markers or keyframes in the timeline.  What should I do to "force reset" the animation-timeline, to allow changes to the length? Combinatorial proof of $\sum^{n}_{i=1}\binom{n}{i}i=n2^{n-1}$. Prove that   $$\sum^{n}_{i=1}\binom{n}{i}i=n2^{n-1}$$   I can't find counting interpretations for either of the sides. A hint of "if $S$ is a subset of $\{1, . . . , n\}$ and $S^\prime$ is its complement then $|S| + |S^\prime| = n$" was also given, but I still don't know how to begin. Showing a tensor is not a simple tensor Let $(e_1,e_2)$ be the standard basis of $\mathbb{R}^2$. Why can the element $e_1\otimes e_2 + e_2\otimes e_1$ in $ \mathbb{R}^2\otimes_{\mathbb{R}} \mathbb{R}^2 $ not be written as a simple tensor $v\otimes w$ for $v,w\in \mathbb{R}^2$?  If we suppose $e_1\otimes e_2 + e_2\otimes e_1=v\otimes w$, then can we conclude that $e_1=\lambda e_2$ for some $\lambda \in \mathbb{R}$? This would give a contradiction since $e_1$ and $e_2$ are linearly independent. However, I am not sure if the argument is valid. How do the comment replies (aka &quot;pinging users&quot;) work?  Who can I send an @reply to? How do I respond to a specific user when entering my comment? Will they be notified? What do people mean when they talk about &quot;pinging&quot; another user?  Related: Tag links in tag excerpts not shown properly If a tag excerpt contains a link to another tag with the [tag:foobar] syntax, this link is not properly shown in every context. For an example see . The link is shown as [tag:school-libraries] but it should be  or at least "school-libraries". From Drupal 8 beta 6 (released today), I have this error :     Error message UnexpectedValueException: Untrusted Host "localhost" in   Symfony\Component\HttpFoundation\Request->getHost() (line 1221 of   core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Request.php).   I use this local url to call my site:   Inside my setting file, I have:       $settings['trusted_host_patterns'] = array(         'theming\.dev$',      );   Note, this error is displayed only when I uncomment this lines:   if (file_exists(__DIR__ . '/settings.local.php')) {    include __DIR__ . '/settings.local.php';  }   What is the problem please ? Thanks.