Search
 
SCRIPT & CODE EXAMPLE
 

CPP

how to find size of int array in c++

#include <iostream>
using namespace std;

int main() {
	int arr[] = {10,20,30,40,50,60};
	int arrSize = sizeof(arr)/sizeof(arr[0]);
	cout << "The size of the array is: " << arrSize;
	return 0;
{
Comment

c++ array size

#include <iostream>
#define ARRAYSIZE(array) (sizeof(array)/sizeof(array[0]))

int main()
{
    int myArray[] = {1,5,46,2,45,7,5};
    std::cout<< ARRAYSIZE(myArray);
    return 0;
}
Comment

PREVIOUS NEXT
Code Example
Cpp :: getch c++ library 
Cpp :: c++ string remove last character 
Cpp :: cpp mst 
Cpp :: c++ product of vector 
Cpp :: optimized bubble sort 
Cpp :: c++ ros publisher 
Cpp :: how to iterater map of sets in c++ 
Cpp :: if even number c++ 
Cpp :: counting sort c++ 
Cpp :: string reversal 
Cpp :: operands c++ 
Cpp :: iff arduino 
Cpp :: chrono start time in c++ 
Cpp :: sort stl 
Cpp :: c++ printf char as hex 
Cpp :: c++ return multiple values 
Cpp :: what is the associative property of an operator 
Cpp :: footnote appears in the middle latex 
Cpp :: delete a node from binery search tree c++ 
Cpp :: primes in range cpp 
Cpp :: c++ foreach 
Cpp :: c++ print string 
Cpp :: array max and minimum element c++ 
Cpp :: calloc c++ 
Cpp :: naive pattern matching algorithm 
Cpp :: function c++ 
Cpp :: throw exception c++ 
Cpp :: draw rectangle opencv c++ 
Cpp :: remove space in string c++ 
Cpp :: image shapes in opencv c++ 
ADD CONTENT
Topic
Content
Source link
Name
3+3 =