W02-FirstProgram

W02-FirstProgram - First Program 9/26/05 1 Programming...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
9/26/05 1 First Program 9/26/05 2 Programming • Programming is an unnatural act. • Humans solve problems without knowing how. • Computers need step-by-step solution (i.e an algorithm). • Our task: – Learn the language (i.e. the tools). – Learn to create algorithms to solve probs (in C). 9/26/05 3 Functions • A C program consists of functions. • Functions are starting points of execution. • Every C program starts with a function called main • Functions can take input and produce output.
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
9/26/05 4 Function Structure int main ( void ) { /* C comment */ // C++ comment return 0; } function name function input (nothing) output type (integer) output value (0) function body start function body end C instruction comments C "period" 9/26/05 5 C Function Libraries • C comes with many libraries of "ready- made" functions. • Two steps to using them. – Use a "#include" statement – Call the function, i.e. write it's name in your program. 9/26/05
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 5

W02-FirstProgram - First Program 9/26/05 1 Programming...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online