K
Kitty
Given a integer array. How can I know the total size of this array? Thanks.
Kitty said:Given a integer array. How can I know the total size of this array?
Thanks.
Kitty said:Given a integer array. How can I know the total size of this array? Thanks.
Rolf Magnus said:Kitty said:Given a integer array. How can I know the total size of this array?
Thanks.
#include <iostream>
int main()
{
int arr[100];
std::cout << "Size in bytes: " << sizeof(arr) << '\n';
std::cout << "Number of elements: " << sizeof(arr)/sizeof(*arr) << '\n';
}
Kitty said:Given a integer array. How can I know the total size of this array? Thanks.
Kitty said:Given a integer array. How can I know the total size of this array?
Thanks.
#include <iostream>
int main()
{
int arr[100];
std::cout << "Size in bytes: " << sizeof(arr) << '\n';
std::cout << "Number of elements: " << sizeof(arr)/sizeof(*arr) << '\n';
}
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.