printf project forat specifier '%s'

    0

    0

    The printf() function prints the string "String Array is initialized" followed by "It work!"

    void printf(char* str, ...)
    {
      char* s;
    
      va_list vl;
      va_start(vl, str);
      for (char* ptr = str; *ptr != '\0'; ptr++)
      {
        if (*ptr == '%')
        {
          ptr++;
          s = va_arg(vl, char*);
          while (*s != '\0')
            putchar(*s++);
        }
        putchar(*ptr);
      }
      va_end(vl);
    }
    
    int main()
    {
      char str[60] = "String Array is initialized";
      printf("abcd %s abcd \n", str);
      printf("It work!\n");
    }
    
    
    Codiga Logo
    Codiga Hub
    • Rulesets
    • Playground
    • Snippets
    • Cookbooks
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.