diff options
| author | Sebastiano Tronto <sebastiano.tronto@gmail.com> | 2021-11-15 07:41:24 +0100 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano.tronto@gmail.com> | 2021-11-15 07:41:24 +0100 |
| commit | 44beaa88e54d60d5c576380534cf5ebb8dd44709 (patch) | |
| tree | 65be441f1783a33facd721ddffb9346a5d98e04b /src | |
| parent | 1a90075f672a442cafa35c1cccbb6cf026c3980e (diff) | |
| download | nissy-44beaa88e54d60d5c576380534cf5ebb8dd44709.tar.gz nissy-44beaa88e54d60d5c576380534cf5ebb8dd44709.zip | |
Fixed used of uninitialized aux variable
Diffstat (limited to 'src')
| -rw-r--r-- | src/utils.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/utils.c b/src/utils.c index f72a00e..1c829c4 100644 --- a/src/utils.c +++ b/src/utils.c | |||
| @@ -159,12 +159,16 @@ is_perm(int *a, int n) | |||
| 159 | { | 159 | { |
| 160 | int *aux = malloc(n * sizeof(int)); | 160 | int *aux = malloc(n * sizeof(int)); |
| 161 | int i; | 161 | int i; |
| 162 | 162 | ||
| 163 | for (i = 0; i < n; i++) | 163 | for (i = 0; i < n; i++) |
| 164 | aux[i] = 0; | ||
| 165 | |||
| 166 | for (i = 0; i < n; i++) { | ||
| 164 | if (a[i] < 0 || a[i] >= n) | 167 | if (a[i] < 0 || a[i] >= n) |
| 165 | return false; | 168 | return false; |
| 166 | else | 169 | else |
| 167 | aux[a[i]] = 1; | 170 | aux[a[i]] = 1; |
| 171 | } | ||
| 168 | 172 | ||
| 169 | for (i = 0; i < n; i++) | 173 | for (i = 0; i < n; i++) |
| 170 | if (!aux[i]) | 174 | if (!aux[i]) |
