+ 1
How to use sizeof
4 ответов
+ 5
sizeof() gives you the size of a data type or variable, in bytes.
cout << sizeof(int) << endl;
int ans = 42;
cout << sizeof(ans) << endl;
Example of use: get the length (= number of elements) of an array:
int arr[10] = {0};
int len = sizeof(arr)/sizeof(arr[0]);
+ 1
thanks jishnu
0
Cout<<Sizeof(x);
OR
i=sizeof(x);
where x is a variable or constant
0
Welcome man