[Courses] C Programming For Absolute Beginners, Lesson 4: Getting Looped

Christopher Howard christopher.howard at frigidcode.com
Tue Mar 6 21:36:23 UTC 2012


On 03/06/2012 11:12 AM, Leslie wrote:
> On Mon, 2012-03-05 at 18:34 -0800, Carla Schroder wrote:
> 
> printf ("\n\n");
> printf ("       *******************************************\n");
> printf ("       *                                         *\n");
> printf ("       *         Two-column Table                *\n");
> printf ("       *             by Leslie                   *\n");
> printf ("       *                                         *\n");
> printf ("       *                                         *\n");
> printf ("       *******************************************\n\n");
> 
> printf(" \t\ta\t       total\n");
> printf ("       ___________________________________________\n\n");
> 
> 

Note that this is an inefficient way to output this text. Less function
calls are generally more efficient than more function calls, because the
processor has to make larger jumps in the code, move parameters, and
such like. I/O calls are especially slow. This would be better:

code:
----------
  puts ("\n\n"
	"       *******************************************\n"
	"       *                                         *\n"
	"       *         Two-column Table                *\n"
	"       *             by Leslie                   *\n"
	"       *                                         *\n"
	"       *                                         *\n"
	"       *******************************************\n\n"
	
	" \t\ta\t       total\n"
	"       ___________________________________________\n\n"
	);
----------

-- 
frigidcode.com
indicium.us



More information about the Courses mailing list