title: Assigning values to two dimensional array in c
body: <p>I have written a piece of code for finding the continuous sum equal to one of the argument provided.</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;string.h&gt;
  
  int main()
  {
      //number of test case
      int n;
      int monfri[2];
  
      scanf("%d",&amp;n);
  
      char res[n][3] ;
      char yestok[3] = {"YES"};
  
      int sum = 0;
      int h = 0;
  
      for(int i = 0 ; i &lt; n; i++)
      {
          h=0;
          //read no of friends and money
          while (h &lt; 2 &amp;&amp; scanf("%d", &amp;monfri[h]) == 1)
              h++;
  
          int fri[monfri[0]];
  
          for(int j = 0; j &lt; monfri[0]; j++)
              scanf("%d",&amp;fri[j]);
  
  
          for(int k = 0; k &lt; monfri[0] ; k++)
          {
              sum = 0;
  
              for(int l=k+1; l&lt;monfri[0]; l++)
              {
                  sum = sum + fri[l - 1];
  
                  if(sum == monfri[1])
                  {
                      strcpy (res[i],yestok);
                      continue;
                  }
  
                  if(sum &gt; monfri[i])
                      continue;
              }
          }       
  
          if(strcmp(res[i],yestok) != 0)
          {
              strcpy (res[i],"NO");       
          }
  
      }
  
      for(int d = 0; d &lt; n ; d++)
      {
          puts(res[d]);
      }
  
      return 0;
  }
  </code></pre>
  
  <p>providing the input for the same </p>
  
  <pre><code>2
  5 12
  2
  3
  4
  5
  6
  3 15
  2
  2
  2
  </code></pre>
  
  <p>Here first input represents the no of test case in our case its 2</p>
  
  <p>the next input represents actual no of data and sum value. here its </p>
  
  <pre><code>5 12
  3 15
  </code></pre>
  
  <p>The expected output should be </p>
  
  <pre><code>YES
  NO
  </code></pre>
  
  <p>But I am getting </p>
  
  <pre><code>YESNO
  NO
  </code></pre>
  
  <p>What wrong I did. If no of test case is 1 then it works fine. but failed in 2 or more test cases.</p>