This generally makes code more understandable you can

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: g performed. This generally makes code more understandable. You can think of a function as simply code that has a name. The name of some chunk of code is what the code does. The s r ( function contains only enough code to find the square root of a qt) number, for example. Where to write your own functions For now, we will write functions in the same file as m i ( so that our programs still consist of just an) one file. Programs need not be just one file, however, and in the future we will explore ways to split up code into multiple files (by putting functions in different files). Functions can be defined above m i ( , or they can have just a prototype (or signature) above an) m i ( w ith the function definition below m i ( . (Function prototypes or definitions cannot be an) an) placed inside other functions.) Here are examples: #nld <otem icue isra> uignmsaesd sn aepc t; / ti i a eapeo afnto flydfndaoemi( / hs s n xml f ucin ul eie bv an) dul tmsw(obex obe ieTodul ) { rtr 2x eun *; } itmi( n a...
View Full Document

Ask a homework question - tutors are online