Variable Scope

In C programming, variables declared within a function are local to the function. Specifically, they’re the auto storage class, the default. External, or global, variables are defined outside of a function declaration and are of the extern storage class. These variables are available to all functions. But the scope within a function can also be limited, depending on where the variable is declared.
Continue reading

Capturing a Program’s Return Value in Linux

As I wrote in last week’s Lesson, the system() function can’t be used in Linux to obtain a program’s return value. Instead, you must use one of the execl() family of functions. Further, this function must be spawned as a child process. This task involves using the fork() and wait() functions.
Continue reading