fork download
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4.  
  5. char buffer[1000];
  6. int bufIndex = 0;
  7.  
  8. void Add(const char *str)
  9. {
  10. int len;
  11.  
  12. len = strlen(str);
  13. strcpy(buffer + bufIndex, str);
  14. bufIndex += len;
  15. }
  16.  
  17. int main()
  18. {
  19. char buf[82];
  20. char *p;
  21. int i;
  22.  
  23. for (i = 1; i <= 80; i++) {
  24. memset(buf, '*', i);
  25. buf[i] = '\n';
  26. buf[i+1] = '\0';
  27. Add(buf);
  28. }
  29. p = strdup(buffer);
  30. printf(p);
  31. free(p);
  32. return 0;
  33. }
  34.  
Success #stdin #stdout 0.02s 1808KB
stdin
Standard input is empty
stdout
*
**
***
****
*****
******
*******
********
*********
**********
***********
************
*************
**************
***************
****************
*****************
******************
*******************
********************
*********************
**********************
***********************
************************
*************************
**************************
***************************
****************************
*****************************
******************************
*******************************
********************************
*********************************
**********************************
***********************************
************************************
*************************************
**************************************
***************************************
****************************************
*****************************************
******************************************
*******************************************
********************************************
*********************************************
**********************************************
***********************************************
************************************************
*************************************************
**************************************************
***************************************************
****************************************************
*****************************************************
******************************************************
*******************************************************
********************************************************
*********************************************************
**********************************************************
***********************************************************
************************************************************
*************************************************************
**************************************************************
***************************************************************
****************************************************************
*****************************************************************
******************************************************************
*******************************************************************
********************************************************************
*********************************************************************
**********************************************************************
***********************************************************************
************************************************************************
*************************************************************************
**************************************************************************
***************************************************************************
****************************************************************************
*****************************************************************************
******************************************************************************
*******************************************************************************
********************************************************************************