From the course: C Essential Training
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Using the main() function's arguments - C Tutorial
From the course: C Essential Training
Using the main() function's arguments
- No matter how graphical the operating system, internally programs are launched and services started by using a command line. First comes the commands name; this is followed by a series of options or switches, (keyboard clicking) the program processes this information as command line input, it works as you see here because these command line arguments are also the arguments to every C program's main function. This exercise file contains the code for the arguments program run at the command prompt, the main functions arguments are set at line three. Specifying these options is optional if they're not used in the code, but they're always available, also you never specify a void between the parentheses, if you're not going to use the arguments just leave the parentheses blank as you've seen in other C language programs where the main functions arguments are not used. These arguments are traditionally named argc, which is an…
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.
Contents
-
-
-
-
-
-
-
Understanding functions3m 21s
-
(Locked)
Creating a function3m 28s
-
(Locked)
Challenge: Writing a function46s
-
(Locked)
Solution: Writing a function1m 10s
-
(Locked)
Returning a value from a function2m 33s
-
(Locked)
Challenge: Returning a value42s
-
(Locked)
Solution: Returning a value1m 40s
-
(Locked)
Passing arguments to a function1m 52s
-
(Locked)
Challenge: Passing values44s
-
(Locked)
Solution: Passing values1m 22s
-
(Locked)
Using the main() function's arguments3m 30s
-
(Locked)
Retaining values in a function2m 58s
-
(Locked)
Creating recursive functions3m 53s
-
(Locked)
Challenge: Complete the code1m 14s
-
(Locked)
Solution: Complete the code1m 31s
-
-