2021年4月25日星期日

C6385 - Reading Invalid Data

I got this warning when i compile my program

Reading invalid data from "revval": the readable size is 'revsize*4 bytes, but '8' bytes may be read

There's too many similar warning appear in my warning list. Its about 6 of them. But all of those looks similar like this code below. Only the variable changed.

Here's the piece of code from my whole program

int revsize = 0;  int* revval;    string revlist[30];  revval = new int[revsize];    system("cls");    cout << "\nHow many revenue do you want to calculate : ";  cin >> revsize;    if (revsize > 0) {      for (int p = 0; p < revsize; p++) {          cout << "Enter the name of the expense : ";          cin >> revlist[p];            cout << revlist[p] << " : ";          cin >> revval[p];          revtotal += revval[p];      }  }  

how to get rid of this warning? i try initialize all the variable before but its doesnt seem to work. im still new in c++ btw

https://stackoverflow.com/questions/67260506/c6385-reading-invalid-data April 26, 2021 at 11:31AM

没有评论:

发表评论