// demo1.c

//C has a important feature that sed did not.  We are allwed to add 
//commands to the standard language interface that accept parameters.

//We can add a command to the c language that prints hello by sending one 
//chcaractor at a time to the video card:

void print_hello(void){
	putchar('H');
	putchar('e');
	putchar('l');
	putchar('l');
	putchar('o');}

//and another that prints goodbye.

void print_bye(void){
	putchar('B');
	putchar('y');
	putchar('e');}


//We can now call it in our program whenever we want with:

//print_hello();
//print_bye();

//The code in there 2 functions looks almost identical and therefore we 
//can pull the common code out into a abstraction.

void printstring(char *s){
	int i;
	for (i=0; s[i]; i++)
		putchar(s[i]);}

//this can now be called through our program by:

//printstring("hello");
//printstring("bye");

//not only that, but we can easily pass it any string that we want to at 
//our convience.

//printstring("This is much easier then sending charactors one at a time");

//we have now created a new language which is very similar to the original C 
//language, but which is more suited to developeing user interfaces.


int main(void){
  print_hello();
  print_bye();
  printstring("hello");
  printstring("bye");
  printstring("This is much easier then sending charactors one at a time");
}



