Pointer and array sizeof, strlen size

Directory What is the name of the array? char arr[] = {‘a’,’b’,’c’,’d’,’e’,’f’};//[a b c d e f] char arr[] = “abcdef”;//[a b c d e f \0] char* p = “abcdef”; Two-dimensional array int a[3][4] = { 0 }; What is the array name? The array name is usually the address of the first element […]

Array (sizeof and strlen) in C language

1. Array creation int type int arr1 [10] = {<!– –>0};//The number of elements is defined, and the first element is assigned a value of 0, then the other elements are all 0 int arr2 [10] = {<!– –>1, 2, 3, 4, 5};//Define the number of elements, but only assign values to the first five […]

Teach you how to distinguish between strlen and sizeof

Foreword I believe that when many veterans come into contact with C language for the first time, they will inexplicably confuse strlen and sizeof in their minds. Here is to distinguish strlen and sizeof for everyone. All code links in this article: test_6_20 hunter/C_NS – Code Cloud – Open Source China (gitee.com) strlen: A library […]

sizeof and strlen! ! !

Definition sizeof() is a unary operator, which can find the size of the space occupied by variables (types), regardless of what is stored in the memory, only the size of the memory strlen() is a function that calculates the length of a string. It scans from a certain location in the memory (it can be […]