Arrays can be passed to a function whole or individual elements can be passed. Array elements passed to a function work like any other single variable. Within a function, a passed array's elements can be modified. The one thing you cannot do is generate an array within a function and return that array.
- [Instructor] Arrays are passed to a function … either whole or each element can be passed individually. … In this code, each element in the array text, at line 11, … is passed to the incshow function. … The function increments the character passed, … and displays the result. … Now the function accepts a single character argument … which is what's passed at line 15. … Variable text x is a single character, … one element in the text array. … Build and run. … Hello! … The incshow function doesn't alter the array, … nor could it, the character passed is used … within the function, then it's discarded … when the function is done. … In this exercise file, the entire array is passed … to the incshow function at line 18. … In the function at line three, … you see the argument is a character variable array … with empty brackets. … This argument indicates that an entire array is passed. … And within the function, the array is modified and output. … Build and run. … Hello again. … In the incshow function, the array's contents are modified. …
- Working with arrays
- Building a structure
- Creating an array of structures
- Testing characters
- Working with strings in C
- Using pointers to manipulate data
- Manipulating files
- Using command-line arguments
- Working with time functions
Skill Level Intermediate
1. Arrays and Structures
2. Characters and Strings
4. Files and the Operating System
5. The Interesting and Extraordinary
Next steps1m 52s
- 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.