title: Own array sprintf variant
body: <p>I've been trying to make my own variant of a sprintf but when I'm passing the first parameter it work and after that it's returning 0.000 and it doesn't work anymore, I don't know what I'm doing wrong after trying so many things. </p>
  
  <pre><code>void sprintf_own_variant() {
      char buf[1024];
      char t[1024];
      char* str;
      get_stack_string(0, &amp;str);
      memcpy(buf, str, 1024);
      printf("size of str = %d\n", strlen(buf)); //debug
      printf("%s\n", buf);
      int len = 0;
  
      for(unsigned int i = 1; i &lt; get_stack_argc(); i++) {
          printf("%d [%s]\n", i, buf);
          //if(len &gt;= 1023)
              //break;
          memset(t, '\0', 1024);
          memcpy(t, buf, strlen(buf));
          switch(get_stack_type(i)) {
              case TYPE_STRING: {
                  char* tmp;
                  get_stack_string(i, &amp;tmp);
                  memset(buf, '\0', 1024);
                  len += sprintf(buf, t, tmp);
              }
              break;
  
              case TYPE_INT: {
                  int tmp;
                  get_stack_int(i, &amp;tmp);
                  memset(buf, '\0', 1024);
                  len += sprintf(buf, t, tmp);
              }
              break;
  
              case TYPE_FLOAT: {
                  float tmp;
                  get_stack_float(i, &amp;tmp);
                  memset(buf, '\0', 1024);
                  len += sprintf(buf, t, tmp);
              }
              break;
          }
      }
      add_stack_string(buf);
  }
  </code></pre>