From the course: Complete Guide to C Programming Foundations
Unlock the full course today
Join today to access over 24,800 courses taught by industry experts.
Using the main() function's arguments - C Tutorial
From the course: Complete Guide to C Programming Foundations
Using the main() function's arguments
- [Instructor] No matter how graphical the operating system, internally, programs are launched and services started by using a command line. First comes the command name. This is followed by options, switches or other information. (keys tapping) The program obtains these command line arguments from the main function where they become the main function's arguments. This exercise file contains the code for the arguments program I just ran the command prompt. The main functions arguments are specified at line 3. If you don't use the arguments, you can leave the parentheses blank, definitely don't put void in there. The first argument is an integer. The argument count or number of items available on the command line. Traditionally it's named argc. The second argument contains the strings or text typed at the command prompt. Each item separated by a space or tab is its own string. You see the string here was enclosed in double quotes, so it becomes a single item. The traditional name for…
Contents
-
-
-
-
-
-
-
Understanding functions3m 11s
-
(Locked)
Creating a function4m 52s
-
(Locked)
Challenge: Writing a function39s
-
(Locked)
Solution: Writing a function1m 49s
-
(Locked)
Returning a value from a function2m 23s
-
(Locked)
Challenge: Returning a value53s
-
(Locked)
Solution: Returning a value2m
-
(Locked)
Passing arguments to a function2m 22s
-
(Locked)
Challenge: Passing values41s
-
(Locked)
Solution: Passing values1m 50s
-
(Locked)
Using the main() function's arguments2m 13s
-
(Locked)
Retaining values in a function2m 34s
-
(Locked)
Creating recursive functions3m 44s
-
(Locked)
Chapter challenge: Write the functions1m 14s
-
(Locked)
Chapter solution: Write the functions2m 15s
-
-
-
-
-
-
-