CSC209H1 Lecture Notes - Lecture 8: Glossary Of Ancient Roman Religion, Target2, Gnu Compiler Collection

31 views6 pages
14 Dec 2016
School
Course
Professor

Document Summary

The order of the functions in a program matters. If it runs into a function declaration that it has not seen before, it will assume that it returns an int. When it reaches the actual declaration, and it returns something different, it will throw an error int do_whatever(){. float do_something_fantastic(int awesome_level){. int do_stuff(){ do_something_fantastic(11); This is ne, since do_stuff calls do_something after it has already been declared int do_whatever(){ do_something_fantastic(11); float do_something_fantastic(int awesome_level){. int do_stuff(){ do_something_fantastic(11); Gcc will have an issue since it reaches the call before the declaration. Sometimes it can even be impossible if you have two different functions that call each other, one can never be rst! Explicitly tell the compiler that functions to expect. When you tell the compiler about a function, it"s called a function declaration float add_with_tax(); The declaration is just a function signature; name, parameters, return type. Once you"ve declared a function, the order of the function de nitions is not important.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents