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
Baham ko'rish
Baham ko'rish
Baham ko'rish
tomonidan
Kaccse
Tarkibini tahrirlash
Chop etish
qo'shib qo'yish
Ko'proq
Tayinlashlar
Ilg'orlar ro'yxati
Ko'proq ko'rsatish
Kamroq koʻrsatish
Ushbu etakchilar jadvali hozirda xususiy. Uni ommaga etkazish uchun
Ulashish-ni
bosing.
Liderlar ro'yxati resurs egasi tomonidan o'chirib qo'yildi.
Ushbu etakchilar ro'yxati o'chirib qo'yilgan, chunki sizning variantlaringiz resurs egasidan farq qiladi.
Qaytish moslamalari
Flesh-kartalar
ochiq-oydin shablon. Etakchilar ro'yxati uchun ballar yaratmaydi.
Tizimga kirish talab qilinadi
Vizual uslub
Shriftlar
Obuna talab etiladi
Moslamalar
Namunani almashtirish
Hammasini koʻrsatish
Faoliyatni o'ynaganingizda ko'proq formatlar paydo bo'ladi.
)
Ochiq natijalar
Bogʻdan nusxa olish
Tez javob kodi
& Olib tashlash
Tahrirlashni davom ettirish:
?