Learning C - Hello world! & function prototype

First program

  • processor instruction
  • main function
//preprocessor directive, include header file stdio.h
#include <stdio.h>

//main function, always the first function called
int main(void)
{
	printf("Hello, world!");
	return 0;
}

Multiple functions

#include <stdio.h>
void sayHello(void);/* ISO/ANSI c function prototyping*/
void syaBye(void);

int main(void)
{
	sayHello();
	sayBye();
	return 0;
}

void sayHello(void)
{
	printf("Hello!\n");
}

void sayBye(void)
{
	printf("Good bye!\n");
}



發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章