From the course: Debugging C Code
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Challenge: Where is the error? - C Tutorial
From the course: Debugging C Code
Challenge: Where is the error?
(upbeat music) - [Instructor] In 1656, English mathematician, John Wallis, published The Wallis Product. which is this equation, a proof using Oilers Infinite Product for the sine function. Now don't fret, computers do the math, you just plug in the equation. Specifically, I'm looking at this part of the equation, which calculates one half the value of pi. In my nerdy attempt to code a C program that calculates pi, I use the Wallis product as an inspiration and crafted this code. This is a draft of my final version of the program but it doesn't work. It builds okay. Does not put any airs, but it runs a little weird. Now the output is zero, which according to my C grades in calculus, isn't anywhere near close to pi. So where did I goof up? The editor and compiler offer no help here. I recommend that you use manual debugging techniques to output variable values as the code runs. Now this code has two flaws in logic.…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.