Things you find in a Java program:
Statements are (always) inside a method !!!
Important property of Object Oriented Programming (OOP) Languages:
OOP (= a class) can restrict the access of certain components inside an object
Things you find in a C program:
Statements are (always) inside a function !!!
C is not an Object Oriented Programming (OOP) Languages:
All global variables and all functions can be used by statements in any function !
|
|
The Hello World program in C:
#include <stdio.h> int main( int argc, char* argv[] ) { printf( "Hello World !\n" ); } |
|
The Hello World program in C:
#include <stdio.h>
int main( int argc, char* argv[] )
{
printf( "Hello World !\n" );
}
|
The #include <stdio.h> command tells the C pre-processor to include the file stdio.h inside /usr/include folder
The file /usr/include/stdio.h is C's standard IO header file
This file contains constant and variable definitions to allow C programs to perform commonly used input/output operations.
The Hello World program in C:
#include <stdio.h>
int main( int argc, char* argv[] )
{
printf( "Hello World !\n" );
}
|
This line is the header of the definition of the main() function
The Hello World program in C:
#include <stdio.h>
int main( int argc, char* argv[] )
{
printf( "Hello World !\n" );
}
|
The printf( ) function prints the parameter string to the terminal (output)
|