Class 21: Command Line Arguments Flashcards

1
Q

%myProg p1 p2 p3

A

Command line arguments

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Any arguments from the command line will be placed in _____ memory

A

Read only

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Int mina(int Argc, char **aargv)
Int main(int argc, char *argv[])

A

Two appropriate declarations if we want to pass command line arguments

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is argc

A

Contains the count of command line arguments

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is argv

A

Contains pointers to the individual arguments as character strings argv[] is an array of char*

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

% myProg 16 new old

A

Argv[0] points to “myProg\0”
Argv[1] points to “16\0’
Argv[2] points to “new\0”
Argv[3] points to “old\0”
Argv[4] is a NULL pointer

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Because these things are of type char*, they are stored in ______ memory and an attempt to write to them will result in a segmentation fault

A

Read only memory

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

It is guaranteed that argc is non-negative and that argv[argc] is a ________

A

NULL POINTER

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

THe main() function is special. Every C program must define it exactly ____

A

ONCE

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Int atoi()

A

Converts an ASCII string to an int (4 byte integer data type)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Double atof()

A

Converts ASCII string to 8 byte floating point data type

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Float f = (float)atof()

A

If you want a 4-byte floating point data type

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly