title: Why break gets me out of 2 loops at once and how to fix it
body: <p>Ok, so the idea of the task I have (I am the student) is to allow user to insert a string of words in this form: num1_num2_num3..._numN. The code should create an array X, give it memory dynamically and then I should fill X with numbers from string user inserted.  Simple as that. Well, in the function <code>stringuniz()</code> I thought I had it all figured out but it simply wont work. It gets the first number well but it then stops and I think its because of the break. Break behaves (if I am right) like it breaks the entire code and not just the loop. Do you guys have an idea why is this happening? </p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;string.h&gt;
  
  void stringuniz(char *);
  int *x;
  
  int main(){
  
      char s[50];
      int i;
  
      puts("Unesite string brojeva u formatu br1_br2_...brN: ");
      gets(s);
  
      stringuniz(s);
  
      for(i=0;i&lt;(sizeof(x)/sizeof(int));i++)
          printf("%d",x[i]);
  }
  
  void stringuniz(char *s){
  
      int duz,c=0,i,j,k=0,m=0;
      char b[10];
  
      duz=strlen(s);
  
      for(i=0;i&lt;duz;i++)
          if(s[i]=='_')
              c++;
  
      x=(int*)malloc((c+1)*sizeof(int));
      if(x==NULL) exit(1);
  
      for(i=0;i&lt;c+1;i++){
          for(j=m;j&lt;duz;j++){
              if(s[j]!='_'){
                  b[k++]=s[j];
                  m++;
              }
              else{
                  b[k]='\0';
                  x[i]=atoi(b);
                  k=0;
                  m++;
                  break;
              }
  
          }
      }
  }
  </code></pre>