Hi guys, what did that mean " Probably, the solution is executed with error 'uninitialized value usage' on the line 38 " ?
and thank's in advance
№ | Пользователь | Рейтинг |
---|---|---|
1 | tourist | 4009 |
2 | jiangly | 3823 |
3 | Benq | 3738 |
4 | Radewoosh | 3633 |
5 | jqdai0815 | 3620 |
6 | orzdevinwang | 3529 |
7 | ecnerwala | 3446 |
8 | Um_nik | 3396 |
9 | ksun48 | 3390 |
10 | gamegame | 3386 |
Страны | Города | Организации | Всё → |
№ | Пользователь | Вклад |
---|---|---|
1 | cry | 167 |
2 | Um_nik | 163 |
3 | maomao90 | 162 |
3 | atcoder_official | 162 |
5 | adamant | 159 |
6 | -is-this-fft- | 158 |
7 | awoo | 157 |
8 | TheScrasse | 154 |
9 | Dominater069 | 153 |
9 | nor | 153 |
Hi guys, what did that mean " Probably, the solution is executed with error 'uninitialized value usage' on the line 38 " ?
and thank's in advance
Название |
---|
Let's say you've declared an integer
n
that denotes the number of elements to be input. In C/C++, if you don't initialise your variables (manually or through input), they're likely going to contain some junk value, say -431094 or whatever that was present there previously. Now, imagine what happens if you try to declare a vector of size n. Boom. There are various places where this might cause an issue but I'm not going to mention all of the ones I know.In your case, which I found in your submissions,
xx
andyy
are uninitialized to begin with. So, when you do an equality check, CF tools detect this and flag it as RTE.include <bits/stdc++.h>
using namespace std;
int main() { int n,a[n+1]; // Probably, the solution is executed with error 'uninitialized value usage' on the line scanf("%d", &n);
}
Why can't I declare a[n+1]. Please reply, thanks in advance!
1) That syntax is not part of C++, it's work only as GCC extension;
2) What do you mean by "can't declare"? You getting some compilation error or what? With extension you can declare array that way;
3) In your code (seriously plz use some formatting in comments — it's horrible to read) problem is you use variable $$$a[n]$$$ which you never read.