Advertisement
GarikK

arraySizeToKnow

Feb 24th, 2020
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.43 KB | None | 0 0
  1. // Arrays.cpp : This file contains the 'main' function. Program execution begins and ends there.
  2. //
  3.  
  4. #include "pch.h"
  5. #include <iostream>
  6. using namespace std;
  7. void MyFunction(int intArray[])
  8. {
  9.     int arraySize = sizeof(intArray);
  10.     int  sizeOfOne = sizeof(int);
  11.     int arrayLength = arraySize / sizeof(int);
  12.     cout << "Array Size is = " << arrayLength << endl;
  13. }
  14. int main()
  15. {
  16.     int tmp[5] = {0,1,2,3,4};
  17.     MyFunction(tmp);
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement