“Как найти длину массива в CPP” Ответ

найти длину массива c

#include <iostream>
using namespace std;
int main() {
   int arr[5] = {4, 1, 8, 2, 9};
   int len = sizeof(arr)/sizeof(arr[0]);
   cout << "The length of the array is: " << len;
   return 0;
}
intricate_symbol

длина массива в CPP

int size = sizeof(arr)/sizeof(arr[0])
Horrible Hare

Как найти размер массива персонажа в c

Instead of sizeof() for finding the length of strings or character 
arrays, just use strlen(string_name) with the header file
#include <cstring>   
it's easier.
Important Ibex

Как найти длину массива в CPP

// you can divide the size of an array 
// by the size of each element (in bytes)
int len = sizeof(arr) / sizeof(arr[0]);
Defiant Dog

Ответы похожие на “Как найти длину массива в CPP”

Вопросы похожие на “Как найти длину массива в CPP”

Смотреть популярные ответы по языку

Смотреть другие языки программирования