title: 450DSA Array in C
body: <p>/**</p>
  <ul>
  <li>@brief Move all negative elements to end</li>
  <li>EX: Given an unsorted array arr[] of size N having both negative and positive integers.</li>
  <li>The task is place all negative element at the end of array</li>
  <li>without changing the order of positive element and negative element.</li>
  <li></li>
  <li>Example 1:
  Input :
  N = 8
  arr[] = {1, -1, 3, 2, -7, -5, 11, 6 }
  Output :
  1  3  2  11  6  -1  -7  -5</li>
  </ul>
  <p>Example 2:
  Input :
  N=8
  arr[] = {-5, 7, -3, -4, 9, 10, -1, 11}
  Output :
  7  9  10  11  -5  -3  -4  -1
  */</p>
  <pre><code>#include&lt;stdio.h&gt;
  
  
  void shortArray(int array[], int stack[]){
      int size = 8;
      int left = 0;
      int right = size;
      for(int i=0; i&lt;size; i++){
  
          if(left = right) break;
  
          volatile int value = array[i];
          if(array[i] &gt; 0){
              stack[left] = value;
              left ++;
          }
          if(array[i] &lt; 0){
              stack[right] = value;
              right--;
          }
      }
  }
  
  //printarray
  void printArray(int array[], int size){
      for(int i=0; i&lt;size; i++){
          printf(&quot; %d&quot;, array[i]);
      }
  }
  int main(){
      int array[] = {-5, 7, -3, -4, 9, 10, -1, 11};
      int size = 8;
      int stack[size];
      shortArray(array, stack);
      printArray(stack, size);
      return 0;
  
  }
  </code></pre>
  <p>my output:
  0 0 0 0 0 0 0 0</p>
  <p>i try to assign value to stack[] but it don't work right.
  i dont know what wrong with it? can you tell me why? thank you!
  sorry for my bad english :&lt;</p>