CS 1200 Lec

studied byStudied by 2 people
5.0(1)
get a hint
hint

Array

1 / 46

Studying Progress

0%
New cards
47
Still learning
0
Almost done
0
Mastered
0
47 Terms
1
New cards

Array

a collection of consecutive memory locations

New cards
2
New cards

Name and Type

Array is a group of variables with the same ___ and ___

New cards
3
New cards

datatype arrayname[size];

syntax for declaring arrays

New cards
4
New cards

0

If there is not enough values in the array, elements are set to ____

New cards
5
New cards

Number of Values

If size is not explicitly defined, the size is determined by the _________

New cards
6
New cards

Access Array Elements

procedure where the index of an array element is specified

New cards
7
New cards

arrayname [index]

syntax for accessing array elements

New cards
8
New cards

0 to size-1

Elements of an array are indexed from ____ to ____

New cards
9
New cards

Constant, Variable, or any Integer Expression

Index may be ____, ____, or ____.

New cards
10
New cards

False

True or False. C checks array bounds.

New cards
11
New cards

Array of arrays

Multidimensional arrays are also called as _____.

New cards
12
New cards

Row and Column

In a matrix named M, it is referenced as M[x][y]. What does x and y represent?

New cards
13
New cards

False. ‘Di pweds i-omit ‘yong size ng column, pero okay lang if row (e.g., int c[][3]={{1,3,0},{2,5,7}};)

True or False. One of the ways in initializing a 2D array is

int c[2][]={{1,3,0},{2,5,7}};

New cards
14
New cards

True

True or False. One of the ways in initializing a 2D array is:

int c[2][3]={1.3.0.-1.5,9};

New cards
15
New cards

String

array of characters

New cards
16
New cards

NULL Character

String is terminated by a ________.

New cards
17
New cards

String Constant

String Literals is also called as ______.

New cards
18
New cards

Double Quotes

String literals are enclosed in a ______.

New cards
19
New cards

Placeholder or Format Specifier

%s is the _____ for strings.

New cards
20
New cards

Splicing

In C programming, it is used if the string literal contains a big sentence to the point where it reached a new line in the code.

New cards
21
New cards

Backslash

syntax of splicing which contains 4 spaces or indentations

New cards
22
New cards

First character

In C, compiler treats a string literal as a pointer to the ______.

New cards
23
New cards

String Variable

single array of characters that is capable of holding a string at a time

New cards
24
New cards

False

True or False. We can modify string literals.

New cards
25
New cards

scanf()

_____ is a function that does not store the white space characters in the string variable.

New cards
26
New cards

%ns

A way to set the limit of scanf() for the number of characters to be stored in the character array.

New cards
27
New cards

A library that contains all the required functions for performing string operations.

New cards
28
New cards

strcpy()

A function that is used to copy a string pointed by a source (including NULL character to the destination (character array).

New cards
29
New cards

True

True or False. In the strcpy(str1,str2), if the length of the string pointed by str2 is greater than the length of the character array str1 then it will be an undefined behavior.

New cards
30
New cards

strcpy(destination,course);

syntax of strcpy() function

New cards
31
New cards

strncpy(destination, source, sizeof(destination));

syntax of strncopy() function

New cards
32
New cards

strlen()

A function that is used to determine the length of the given string.

New cards
33
New cards

False

strlen() counts the NULL character.

New cards
34
New cards

strcat()

string concatenate function

New cards
35
New cards

strcat()

A function that appends the content of string str2 at the end of the string str1.

New cards
36
New cards

strncat()

A safer version of strcat.

New cards
37
New cards

strncat()

A function that appends the limited number of characters specified by the third argument passed to it.

New cards
38
New cards

False

strncat() function does not automatically add NULL character at the end of the resultant string.

New cards
39
New cards

strncat(str1, str2, sizeof(str1) - strlen(str2) - 1);

syntax of strncat()

New cards
40
New cards

strcmp ()

string comparison function

New cards
41
New cards

less than

strcmp() returns a value that is ____ 0, if s1 < s2

New cards
42
New cards

greater than

strcmp() returns a value that is _____ 0, if s1 > s2

New cards
43
New cards

equal to

strcmp() returns a value that is ____ 0, if s1 == s2

New cards
44
New cards

65 to 90

range of ASCII codes of upper case letters

New cards
45
New cards

97 to 122

range of ASCII codes of lower case letters

New cards
46
New cards

48 to 57

range of ASCII codes of 0 to 9 digits

New cards
47
New cards

32

ASCII code of space character

New cards

Explore top notes

note Note
studied byStudied by 9 people
Updated ... ago
5.0 Stars(1)
note Note
studied byStudied by 12 people
Updated ... ago
5.0 Stars(1)
note Note
studied byStudied by 4 people
Updated ... ago
5.0 Stars(3)
note Note
studied byStudied by 18 people
Updated ... ago
5.0 Stars(1)
note Note
studied byStudied by 1324 people
Updated ... ago
4.7 Stars(18)
note Note
studied byStudied by 8 people
Updated ... ago
5.0 Stars(1)
note Note
studied byStudied by 8 people
Updated ... ago
5.0 Stars(1)
note Note
studied byStudied by 2110 people
Updated ... ago
4.3 Stars(17)

Explore top flashcards

flashcards Flashcard73 terms
studied byStudied by 2 people
Updated ... ago
5.0 Stars(1)
flashcards Flashcard80 terms
studied byStudied by 63 people
Updated ... ago
5.0 Stars(1)
flashcards Flashcard36 terms
studied byStudied by 32 people
Updated ... ago
5.0 Stars(1)
flashcards Flashcard33 terms
studied byStudied by 19 people
Updated ... ago
5.0 Stars(4)
flashcards Flashcard92 terms
studied byStudied by 1 person
Updated ... ago
5.0 Stars(1)
flashcards Flashcard141 terms
studied byStudied by 22 people
Updated ... ago
5.0 Stars(1)
flashcards Flashcard30 terms
studied byStudied by 7 people
Updated ... ago
5.0 Stars(1)
flashcards Flashcard43 terms
studied byStudied by 299 people
Updated ... ago
5.0 Stars(2)