Join Dan Gookin for an in-depth discussion in this video Working with arrays and functions, part of Advanced C Programming.
- It's really nothing to pass an array to a function.…Doing so doesn't require any magic or secret incantations.…It does, however, require acceptance of the fact…that arrays and pointers behave similarly.…Don't let that freak you out.…When you pass an array to a function…you're passing the base address of the array in memory,…that's a pointer.…Open exercise 04-04_arrayfunc1.…This code is a modification from an earlier exercise file,…the one that sorts an array of random values.…
In this modification I've moved…the major operations out of the main function…and put each into its own function.…All the functions are prototypes starting at line seven.…Each function has the same argument, an integer array.…At line seven I've used array notation, that's fine,…and in lines eight and nine, I've used pointer notation.…They're all the same.…In fact, I'll edit line seven to use pointer notation.…Each of the functions is called…by specifying the array name only.…
You see this in the main function…at lines 16, 20, 23 and 27.…
Author
Released
1/15/2015- Using assignment operators
- Working with arguments in the main function
- Setting up global variables
- Using static variables
- Sorting an array
- Building an array of structures
- Working with the ampersand (&) and asterisk (*) pointer operators
Skill Level Intermediate
Duration
Views
-
-
Welcome56s
-
-
Introduction
-
1. C Programming: Weird-Symbol Roundup
-
Using assignment operators3m 41s
-
-
2. Main Function Arguments
-
3. Beyond Basic Variables
-
Typecasting variables4m 46s
-
4. Arrays and Structures
-
Sorting an array6m 39s
-
Solution: Sorting a string1m 25s
-
-
5. Pointer Tips
-
Conclusion
-
Next steps1m 49s
-
- 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.
CancelTake 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.
Share this video
Embed this video
Video: Working with arrays and functions