Title: /* a program to print Hello World */
1A simple C program
/ a program to print Hello World / /
/ includeltstdio.hgt int main(void) printf(
Hello World \n ) return(0)
2- Comment lines
- ignored by the compiler
- can be placed any where
/ a program to print Hello World / /
/ includeltstdio.hgt int main(void)
- preprocessor directive begins with - lt gt
files are located in C lib. - h indicates a
header file - stdio standard input output lib
spaces are allowed between lines of code
- declares the function main
- every C program requires this
braces mark the beginning and end
of a block of code
3Control string in quotation marks
May contain text and/or conversion specifiers
New line indicator Causes a skip to the next line
printf( Hello World \n ) return(0)
Ends execution of the program and returns
control to the operating system
4Assignment 1 a
Write and run a program in C code to print a one
line wisdom expression such as what consumes
your mind will control your life . Compile the
source file with a Borland C or C compiler.
5Assignment 1b
Type out the source file and the output for a
FORTRAN program that will produce the same
wisdom statement as in 1a.
6(No Transcript)