Join Dan Gookin for an in-depth discussion in this video Passing values to a function, part of Learning C (2014).
- A function has got to funct, it's that IO thing again,…sure, avoid function as necessary,…and obviously valid, but most functions chew on input,…and do something based on that input.…In this movie, I explore how functions can deal…with arguments or values passed to the function.…You'll see how to declare such a function,…how it deals with values, and how to pass more…than a single value to a function.…This code contains the repeat function,…which accepts one argument, an integer.…
Within the function, the integer variable is named count.…The function is called at lines eight and 10.…Each time, with a different argument.…Inside the function, a local variable, x, is declared.…It's used in the four statement, along…with a count variable, build and run this code.…The function can also accept integer variables as arguments.…Make these modifications to the code.…In the main function, declare integer variables a and b.…
Assign the value 1 to a, and 5 to b.…Use a and b in the two repeat functions.…Save the changes, build and run, and the output is the same.…
- Understanding a C program
- Adding comments
- Using escape characters
- Working with values and placeholders
- Introducing variables
- Making a decision with if
- Adding functions
- Manipulating strings
- Building arrays
- Nesting structures
Skill Level Beginner
1. Getting Started
2. Programming Basics
3. Program Flow Control
4. Intermediate C Language Concepts
5. Advanced C Language Concepts
Next steps2m 11s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.