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
Del
Del
Del
etter
Kaccse
Rediger innhold
Skriv ut
Innebygd
Mer
Tildelinger
Ledertavle
Vis mer
Vis mindre
Denne ledertavlen er for øyeblikket privat. Klikk
Share
for å gjøre den offentlig.
Denne ledertavlen er deaktivert av ressurseieren.
Denne ledertavlen er deaktivert fordi alternativene er forskjellige fra ressurseieren.
Alternativer for tilbakestilling
Flash-kort
er en åpen mal. Det genererer ikke poengsummer for en ledertavle.
Pålogging kreves
Visuell stil
Skrifter
Krever abonnement
Alternativer
Bytt mal
Vis alle
Flere formater vises når du spiller av aktiviteten.
)
Åpne resultater
Kopier kobling
QR-kode
Slette
Gjenopprett automatisk lagring:
?