Created
August 3, 2016 22:26
-
-
Save wohhie/ab4e148b0ee0e9c15b7a81896e42d370 to your computer and use it in GitHub Desktop.
Find Array Size & Size of the int value.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//find array size | |
#include <iostream> | |
#include <cstdlib> | |
#include <math.h> | |
using namespace std; | |
//processoing... | |
void search() { | |
//list of data | |
int dataList[] = { | |
911, | |
212, | |
92, | |
1221, | |
1231, | |
3, | |
242, | |
19 | |
}; | |
int counter = 0; | |
int dataSize = sizeof(dataList) / sizeof(dataList[0]); | |
int find = 912; | |
int length = (int)(log10(find) + 1); | |
cout << "\nArray Size: " << dataSize << endl; | |
cout << "finiding elm length: " << length << endl; | |
for (int i = 0; i < dataSize; i++) { | |
} | |
cout << counter << endl; | |
} | |
int main() { | |
search(); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment