A Different Type Of Printf

Code Id 3
Date Updated 3/7/2010
Title A different type of printf  
Description
Write an expression of the form printf("%s",...) having exactly the same effect as printf("%5d",123). 
                                  
Codes Snippet
#include
int main(void)
{
  char x[10];
  char y[10];

  sprintf(x,"%s","  123");
  sprintf(y,"%5d",123);
  if (strcmp(x,y) == 0) printf("Success!n");
  return 0;
}

Comments are closed.