title: C langugage - "Weird" characters in char[] output
body: <p>I had to build a C program which convert's infix notation into postfix notation using STACK. That went well and it's working in some way. It was long ago when I used last time C language so I'm probably dont use char[] variables very well.</p>
  
  <p>So problem is that when I give input like this :</p>
  
  <pre><code>A+B*(C*E-D)
  </code></pre>
  
  <p>My program returns this :</p>
  
  <pre><code>ABCE*D-*+ĚĚĚĚĚĚĚĚĚĚĚ
  </code></pre>
  
  <p>So as you see my program did postfix conversion very well but I have bunch of "garbage" chars at my result (ĚĚĚĚĚĚĚĚĚĚĚ).</p>
  
  <p>Here is snippet of my code (only part that I think is not correct, maybe something with char[] and way how I assing value to postfix[] variable:</p>
  
  <pre><code>int main()
  {
      char infix[20], postfix[20];
      int len, tip, i, p=0;
  
      STACK pom;
      MAKE_NULL(&amp;pom);
  
      printf ("Unesi izraz.\n");
      scanf ("%s", infix);
  
      len = strlen(infix);
  
      for(i=0; i&lt;len; i++)
      {
          tip = nadi_tip(infix[i]);
  
          if (tip == Lijeva)
          {
              PUSH (infix[i], &amp;pom);
          }
  
          if (tip == Operand)
          {
              postfix[p] = infix[i];
              p++;
          }
  
          if (tip == Desna)
          {
              while (!EMPTY(pom) &amp;&amp; (TOP(pom)!= '('))
                {
                  postfix[p++] = TOP(pom);
                  POP (&amp;pom);
                }
              POP (&amp;pom);
          }
  
          if (tip == Operator)
          {
              while (!EMPTY(pom) &amp;&amp; TOP(pom)!= '(')
               {
                  if(prioritet(infix[i]) &lt;= prioritet(TOP(pom)))
                  {
                    postfix[p++] = TOP(pom);
                    POP (&amp;pom);
                  }
                  else break;
               }
               PUSH(infix[i], &amp;pom);
          }
      }
   while (EMPTY(pom) != 1)
   {
      postfix[p++] = TOP(pom);
      POP(&amp;pom);
   }
  
   printf("Izlaz: %s", postfix);
   return 0;
  
  }
  </code></pre>
  
  <p>infix[] is my input and postfix[] is my output. What did I do wrong I why am I having ĚĚĚĚĚĚĚĚĚĚĚ characters. Thank you in advance!</p>