Difference between revisions of "Advance-C/C2/Command-line-arguments-in-C/English-timed"

From Script | Spoken-Tutorial
Jump to: navigation, search
(Created page with " {| Border = 1 ! <center>Time</center> ! <center>Narration</center> |- | 00:01 |Hello and welcome to the spoken tutorial on''' Command Line Arguments.''' |- | 00:07 |In this...")
 
 
(8 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 
 
{| Border = 1
 
{| Border = 1
! <center>Time</center>
+
| '''Time'''
! <center>Narration</center>
+
|'''Narration'''
  
 
|-
 
|-
 
| 00:01
 
| 00:01
|Hello and welcome to the spoken tutorial on''' Command Line Arguments.'''
+
|Hello and welcome to the '''spoken tutorial''' on''' Command Line Arguments.'''
  
 
|-
 
|-
 
| 00:07
 
| 00:07
|In this tutorial, we will learn about  '''main function with arguments''' with an example.
+
|In this tutorial, we will learn about  '''main()''' function with '''arguments''', with an example.
  
 
|-
 
|-
 
| 00:15
 
| 00:15
|For this tutorial I am using  '''Ubuntu Operating system version 11.10''' and  '''gcc Compiler version 4.6.1 on Ubuntu'''
+
|For this tutorial, I am using  '''Ubuntu Operating system''' version '''11.10''' and  '''gcc Compiler''' version '''4.6.1''' on Ubuntu.
  
 
|-
 
|-
Line 22: Line 21:
 
|-
 
|-
 
| 00:33
 
| 00:33
| If not, for relevant tutorials please visit our website which is as shown.
+
| If not, for relevant tutorials, please visit our website which is as shown.
  
 
|-
 
|-
Line 30: Line 29:
 
|-
 
|-
 
| 00:45
 
| 00:45
|Filename is '''main hyphen with hyphen args.c'''
+
|File name is '''main hyphen with hyphen args.c'''.
  
 
|-
 
|-
Line 38: Line 37:
 
|-
 
|-
 
| 00:53
 
| 00:53
|These are the '''header files.''' '''stdio.h '''defines '''core input''' and '''output functions'''.
+
|These are the '''header''' files. '''stdio.h '''defines '''core input''' and '''output''' functions.
  
 
|-
 
|-
 
| 01:01
 
| 01:01
 
|'''stdlib.h header file''' defines-
 
|'''stdlib.h header file''' defines-
* '''Numeric conversion function'''.
+
'''Numeric conversion function'''
* '''Pseudo-random numbers'''.
+
'''Pseudo-random numbers'''
* '''Generation function'''.
+
'''Generation function'''
* '''Memory allocation'''.
+
'''Memory allocation'''
* '''Process control functions'''.
+
'''Process control functions'''.
  
 
|-
 
|-
 
|01:16
 
|01:16
|This is our '''main function.''' Inside this, we have passed '''two arguments'''-
+
|This is our '''main()''' function. Inside this, we have passed two arguments-
'''int argc,  char  asterisk asterisk argv''' (**argv)
+
'''int argc,  char  asterisk asterisk argv''' (**argv).
  
 
|-
 
|-
 
| 01:28
 
| 01:28
|'''“argc”''' refers to the number of '''command line arguments''' passed to the program.
+
| '''argc''' refers to the number of '''command line arguments''' passed to the program.
  
 
|-
 
|-
Line 64: Line 63:
 
|-
 
|-
 
| 01:38
 
| 01:38
|'''argv''' contains actual '''arguments''' starting from '''index 0'''.
+
|'''argv''' contains actual '''argument'''s starting from '''index 0'''.
  
 
|-
 
|-
Line 76: Line 75:
 
|-
 
|-
 
| 01:53
 
| 01:53
|'''Index 2''' will be the second '''argument''' passed to the program. And so on.
+
|'''Index 2''' will be the second '''argument''' passed to the program and so on.
  
 
|-
 
|-
Line 84: Line 83:
 
|-
 
|-
 
| 02:05
 
| 02:05
|This will display the '''first argument''' passed to the program.
+
|This will display the first argument passed to the program.
  
 
|-
 
|-
Line 92: Line 91:
 
|-
 
|-
 
| 02:13
 
| 02:13
|'''While condition''' will decrement the number of '''arguments'''.
+
|''''while' condition''' will decrement the number of arguments.
  
 
|-
 
|-
Line 100: Line 99:
 
|-
 
|-
 
| 02:23
 
| 02:23
|At the end we have''' return 0 '''statement.
+
|At the end, we have''' return 0 '''statement.
  
 
|-
 
|-
 
| 02:27
 
| 02:27
|Let us open the '''terminal''' by pressing '''Ctrl+Alt+T''' keys simultaneously on your keyboard.
+
|Let us open the '''terminal''' by pressing '''Ctrl+Alt''' and '''T''' keys simultaneously on your keyboard.
  
 
|-
 
|-
 
| 02:35
 
| 02:35
|Type:''' gcc space main hyphen with hyphen args.c space hyphen o space args'''. Press''' Enter'''
+
|Type:''' gcc space main hyphen with hyphen args.c space hyphen o space args'''. Press''' Enter'''.
  
 
|-
 
|-
Line 117: Line 116:
 
| 02:54
 
| 02:54
 
|You can see the output as:
 
|You can see the output as:
'''Total number of arguments are 1 '''
+
 
'''The first argument is null '''
+
'''"Total number of arguments are 1"'''
'''arguments are ./args '''
+
 +
'''"The first argument is null"'''
 +
 +
'''"arguments are ./args"'''
  
 
|-
 
|-
Line 127: Line 129:
 
|-
 
|-
 
| 03:11
 
| 03:11
|'''Total number of arguments are 1''' as the '''zeroth argument''' is the executable filename itself.
+
|'''Total number of arguments are 1''' as the zeroth argument is the executable filename itself.
  
 
|-
 
|-
 
| 03:19
 
| 03:19
|'''The first argument is (null) '''as we have not passed any '''argument''' to the program.  
+
|'''The first argument is null '''as we have not passed any argument to the program.  
  
 
|-
 
|-
 
| 03:26
 
| 03:26
|'''Arguments''' are only one ie. '''dot slash args'''
+
|'''Argument''' is only one i.e. '''dot slash args'''.
  
 
|-
 
|-
 
| 03:31
 
| 03:31
|Now let us execute again
+
|Now let us execute again.
  
 
|-
 
|-
 
| 03:34
 
| 03:34
|Press the uparrow key '''space''' type '''Sunday space Monday space Tuesday'''. Press '''Enter'''
+
|Press the up-arrow key '''space''' type: '''Sunday space Monday space Tuesday'''. Press '''Enter'''.
  
 
|-
 
|-
Line 149: Line 151:
 
|Now we can see the output:
 
|Now we can see the output:
 
'''Total number of arguments are 4 '''
 
'''Total number of arguments are 4 '''
 +
 
'''The first argument is Sunday '''
 
'''The first argument is Sunday '''
'''Argument are ./args ''' '''Sunday Monday ''' and '''Tuesday '''.
+
 
 +
'''Arguments are ./args ''' '''Sunday Monday ''' and '''Tuesday '''.
  
 
|-
 
|-
Line 158: Line 162:
 
|-
 
|-
 
| 04:06
 
| 04:06
|Total number of arguments are 4 as '''./args, Sunday, Monday''' and '''Tuesday.'''
+
|Total number of arguments are 4 as- '''./args, Sunday, Monday''' and '''Tuesday.'''
  
 
|-
 
|-
 
| 04:14
 
| 04:14
|The '''first argument''' is '''Sunday '''
+
|The first argument is '''Sunday'''.
  
 
|-
 
|-
 
| 04:17
 
| 04:17
|The '''zeroeth argument''' always gives executable filename.
+
|The zeroth argument always gives executable file-name.
  
 
|-
 
|-
 
| 04:22
 
| 04:22
|'''Sunday''' is assigned to '''first argument'''.
+
|'''Sunday''' is assigned to first argument.
  
 
|-
 
|-
 
| 04:25
 
| 04:25
|'''Monday '''is assigned to '''second argument.'''
+
|'''Monday''' is assigned to second argument.
  
 
|-
 
|-
 
| 04:28
 
| 04:28
|'''Tuesday '''is assigned to '''third argument'''.  
+
|'''Tuesday''' is assigned to third argument.  
  
 
|-
 
|-
Line 186: Line 190:
 
|-
 
|-
 
| 04:37
 
| 04:37
|In this tutorial we learnt,
+
|In this tutorial, we learnt:
* '''Command line arguments'''
+
'''Command line arguments'''
* '''argc'''
+
'''argc'''
* '''argv'''
+
'''argv'''.
  
 
|-
 
|-
 
| 04:45
 
| 04:45
|As an assignment, execute the program with different '''arguments'''.
+
|As an assignment, execute the program with different '''argument'''s.
  
 
|-
 
|-
 
| 04:51
 
| 04:51
|Watch the video available at the link shown below
+
|Watch the video available at the link shown below.
  
 
|-
 
|-
 
| 04:54
 
| 04:54
|It summarises the Spoken Tutorial project  
+
|It summarizes the Spoken Tutorial project.
  
 
|-
 
|-
 
| 04:57
 
| 04:57
|If you do not have good bandwidth, you can download and watch it
+
|If you do not have good bandwidth, you can download and watch it.
  
 
|-
 
|-
 
| 05:02
 
| 05:02
|The Spoken Tutorial Project Team , Conducts workshops using spoken tutorials  
+
|The Spoken Tutorial Project team: Conducts workshops using spoken tutorials.
  
 
|-
 
|-
Line 217: Line 221:
 
|-
 
|-
 
| 05:18
 
| 05:18
|Spoken Tutorial Project is a part of the Talk to a Teacher project
+
|'''Spoken Tutorial''' Project is a part of the '''Talk to a Teacher''' project.
  
 
|-
 
|-
 
| 05:22
 
| 05:22
|It is supported by the National Mission on Education through ICT, MHRD, Government of India
+
|It is supported by the National Mission on Education through ICT, MHRD, Government of India.
  
 
|-
 
|-
 
| 05:30
 
| 05:30
|More information on this Mission is available at: '''http://spoken-tutorial.org\NMEICT-Intro'''
+
|More information on this mission is available at the link shown below: http://spoken-tutorial.org\NMEICT-Intro.
  
 
|-
 
|-
 
| 05:36
 
| 05:36
|This is Ashwini Patil from IIT Bombay signning off.
+
|This is Ashwini Patil from IIT Bombay, signning off.Thank you for joining.
Thank you for joining.
+
  
 
|}
 
|}

Latest revision as of 12:17, 22 February 2017

Time Narration
00:01 Hello and welcome to the spoken tutorial on Command Line Arguments.
00:07 In this tutorial, we will learn about main() function with arguments, with an example.
00:15 For this tutorial, I am using Ubuntu Operating system version 11.10 and gcc Compiler version 4.6.1 on Ubuntu.
00:27 To follow this tutorial, you should be familiar with C tutorials.
00:33 If not, for relevant tutorials, please visit our website which is as shown.
00:39 Let us start with our program. I have a code file. I will open it.
00:45 File name is main hyphen with hyphen args.c.
00:50 Let me explain the program.
00:53 These are the header files. stdio.h defines core input and output functions.
01:01 stdlib.h header file defines-

Numeric conversion function Pseudo-random numbers Generation function Memory allocation Process control functions.

01:16 This is our main() function. Inside this, we have passed two arguments-

int argc, char asterisk asterisk argv (**argv).

01:28 argc refers to the number of command line arguments passed to the program.
01:34 This includes the actual name of the program.
01:38 argv contains actual arguments starting from index 0.
01:44 Index 0 is the name of the program.
01:48 Index 1 will be the first argument passed to the program.
01:53 Index 2 will be the second argument passed to the program and so on.
01:59 This statement will display the total number of arguments passed to the program.
02:05 This will display the first argument passed to the program.
02:09 1 represents the argument at index 1.
02:13 'while' condition will decrement the number of arguments.
02:18 This statement will print all the arguments passed to the program.
02:23 At the end, we have return 0 statement.
02:27 Let us open the terminal by pressing Ctrl+Alt and T keys simultaneously on your keyboard.
02:35 Type: gcc space main hyphen with hyphen args.c space hyphen o space args. Press Enter.
02:49 Type: dot slash args. Press Enter.
02:54 You can see the output as:

"Total number of arguments are 1"

"The first argument is null"

"arguments are ./args"

03:06 Command line arguments are given during execution.
03:11 Total number of arguments are 1 as the zeroth argument is the executable filename itself.
03:19 The first argument is null as we have not passed any argument to the program.
03:26 Argument is only one i.e. dot slash args.
03:31 Now let us execute again.
03:34 Press the up-arrow key space type: Sunday space Monday space Tuesday. Press Enter.
03:47 Now we can see the output:

Total number of arguments are 4

The first argument is Sunday

Arguments are ./args Sunday Monday and Tuesday .

04:04 Let me explain the output.
04:06 Total number of arguments are 4 as- ./args, Sunday, Monday and Tuesday.
04:14 The first argument is Sunday.
04:17 The zeroth argument always gives executable file-name.
04:22 Sunday is assigned to first argument.
04:25 Monday is assigned to second argument.
04:28 Tuesday is assigned to third argument.
04:31 This brings us to the end of this tutorial. Let us summarize.
04:37 In this tutorial, we learnt:

Command line arguments argc argv.

04:45 As an assignment, execute the program with different arguments.
04:51 Watch the video available at the link shown below.
04:54 It summarizes the Spoken Tutorial project.
04:57 If you do not have good bandwidth, you can download and watch it.
05:02 The Spoken Tutorial Project team: Conducts workshops using spoken tutorials.
05:08 Gives certificates to those who pass an online test. For more details, please write to contact@spoken-tutorial.org
05:18 Spoken Tutorial Project is a part of the Talk to a Teacher project.
05:22 It is supported by the National Mission on Education through ICT, MHRD, Government of India.
05:30 More information on this mission is available at the link shown below: http://spoken-tutorial.org\NMEICT-Intro.
05:36 This is Ashwini Patil from IIT Bombay, signning off.Thank you for joining.

Contributors and Content Editors

PoojaMoolya, Pratik kamble, Sandhya.np14