My issue
My code
#include <bits/stdc++.h>
using namespace std;
int main() {
int a[5]={10,20,30,40,50};
return 0;
}
Learning course: Learn C++
Problem Link: CodeChef: Practical coding for everyone
#include <bits/stdc++.h>
using namespace std;
int main() {
int a[5]={10,20,30,40,50};
return 0;
}
Learning course: Learn C++
Problem Link: CodeChef: Practical coding for everyone
@karanbhoi
this is the code for reference
include <bits/stdc++.h>
using namespace std;
int main() {
int myNumbers[]={10,20,20,40,50,60};
cout<<sizeof(myNumbers)/sizeof(myNumbers[0]);
return 0;
}
since all are integer the sizeof operator will give 4*size of the array and when i devide it with sizeof only one array element then only size of the array will remain .
This is the whole logic
you can also use arrayName.length