What is an array in C?, A collection of elements of the same data type stored in contiguous memory locations., How do you declare a single dimensional array?, int arr[5];, What is the index of the first element in an array?, 0, What is the index of the last element in an array of size n?, n – 1, How do you initialize an array during declaration?, int arr[5] = {1,2,3,4,5};, What happens if fewer elements are given during initialization?, Remaining elements are initialized to 0 or garbage value, What is unsized array initialization, Array size is not specified, compiler determines size automatically. int arr[] = {10,20,30};, Is unsized array allowed without initialization?, No, Can unsized arrays be used with strings?, Yes. char str[] = "Hello";, What is a two-dimensional array?, An array of arrays used to store data in rows and columns., Syntax for declaring a 2D array?, int arr[3][4];, How many elements are there in int arr[3][4];?, 12, How are elements accessed in a 2D array?, Using row and column index. arr[1][2], Give an example of 2D array initialization., int arr[2][3] = { {1,2,3}, {4,5,6}};, Which loops are usually used to traverse a 2D array?, Nested loops, What is a multidimensional array?, An array having more than two dimensions., How many elements are there in int arr[2][3][4];, 24, Which loops are required to traverse a 3D array?, Three nested loops, What is a string in C?, A string is a character array terminated by '\0'., How do you declare a string?, char str[20];, How do you initialize a string?, char str[] = "Hello";, Which function reads a string with spaces?, fgets(), Which function finds the length of a string?, strlen(), Which function copies one string to another?, strcpy(), Which function compares two strings?, strcmp(), What is an array of strings?, A collection of multiple strings stored in a 2D character array., What is an Array of Character Pointers?, An array of character pointers is an array where each element is a pointer that points to the first character of a string., How many strings can char name[4][10]; store?, 4 strings, What is the maximum length of each string in char name[4][10];?, 9 characters + \0, Which format specifier is used to print a string?, %s, Which header file is required for string functions?, string.h, What happens if \0 is missing in a string?, String functions may read garbage values., Are strings stored continuously in array of character pointers?, No., Are strings stored continuously in a 2D character array?, Yes., Give one advantage of array of character pointers., Strings can have variable length..
0%
C Programming Module 2
Ibahagi
Ibahagi
Ibahagi
ni
Kaccse
I-edit ang Nilalaman
I-print
Naka-embed
Higit pa
Mga Assignment
Leaderboard
Magpakita pa
Huwag gaanong magpakita
Ang leaderboard na ito ay kasalukuyang pribado. I-click ang
ibahagi
upang gawin itong pampubliko.
Ang leaderboard na ito ay hindi pinagana ng may-ari ng aktibidad.
Hindi pinagana ang leaderboard na ito dahil ang iyong mga pagpipilian ay naiiba sa may-ari ng aktibidad..
Ibalik ang Opsyon
Flash cards
ay isang bukas na template. Hindi ito bumubuo ng mga marka para sa isang leaderboard.
Kailangan maglog-in
Estilo ng visual
Mga Font
Kailangan ang subscription
Mga pagpipilian
Magpalit ng template
Ipakita lahat
Mas marami pang format ang lilitaw habang nilalaro ang aktibidad.
)
Buksan ang mga resulta
Kopyahin ang link
QR code
Tanggalin
Ibalik ng awtomatikong pag-save:
?