title: runtime error sigsegv
body: <p>i am getting runtime error sigsegv, i don't understand the problem with this code.
  this is a program to match initial substring with with array of string having maximum priority.</p>
  
  <pre><code>#include&lt;stdio.h&gt;
  #include&lt;limits.h&gt;
  int main() {
      int T,i,N;
      char si[T][1000];
     long vi[T];
  scanf("%d",&amp;T);
  for(i=0;i&lt;T;++i)
              scanf("%s%ld",&amp;si[i],&amp;vi[i]);
  
  scanf("%d",&amp;N);
  while(N--) {
             char str[1000];
             scanf("%s",str);
               int j,maxPindex=-1;
               long maxPriority=LONG_MIN;
               int l=strlen(str);
               for(j=0;j&lt;T;++j) {
                       if(strlen(si[j])&gt;=l &amp;&amp; strncmp(str,si[j],l)==0 &amp;&amp;  vi[j]&gt;maxPriority) {
                                                 maxPriority=vi[j];
                                                 maxPindex=j;
                       }                                                
               }
               //free(str);
               if(maxPindex==-1) printf("NO\n");
               else printf("%s\n",si[maxPindex]);
   }
  return (0);
  
  }
  </code></pre>