The instructor presents a solution to the challenge, discussing the function written, its elements, and why each is important. Alternative solutions and potential problems are reviewed.
(bright upbeat music) … - Here is my rendition of the solution … where I wrote the line function, before the main function. … In the function, I use variable A … in a loop repeating 40 times. … The putchar function outputs the 40 hyphens, … and a second putchar function outputs a new line, … which keeps the line, on a line by itself, build and run. … And there's the output. … If your programs output looks like this, … you've successfully worked the challenge. … In this variation, which is also a correct solution, … I wrote the line function after the main function. … In this arrangement, the line function must be prototyped … which you see here on line three. … This solution is also valid … and I won't count points off if you came up with it. … It's creative. … Of course, if you're required to modify the function later, … say to generate a line of variable length, … then it'll be more work. … Still, this solution works. … So kudos to you if you came up with it. … …
- Writing your first C program
- Working the C development cycle
- Adding comments to code for clarity
- C language data types
- Declaring variables
- Making new data types
- Typecasting variables
- Using math, assignment, and logical operators
- Creating for and while loops
- Nesting loops
- Creating functions
- Returning values from functions
- Passing arguments to functions
- Creating recursive functions
Skill Level Intermediate
C: Data Structures, Pointers, and File Systemswith Dan Gookin2h 57m Intermediate
1. The Fundamentals of C
2. Variables and Values
3. Operators and Math
4. Decisions and Loops
Next steps1m 38s
- 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.