mercredi 22 mai 2019

How can I measure the memory limit of a program?

I want to find the total memory spaces, which is used in program..how can I measure it.

int main(){

int n;
long long sum = 0, maxi = 0;
scanf("%d",&n);
int a[n+2];

for(int i=0;; i<n; i++){
   scanf("%d",&a[i]);
   sum += a[i];
   maxi = max(a[i],maxi);
}
double avg = double(sum)/double(n);
return 0;

}

Aucun commentaire:

Enregistrer un commentaire