0 Members and 1 Guest are viewing this topic.
#include <stdio.h>using namespace std;int main(){ int n; scanf("%d", &n); int avenidas[99]; int ruas[99]; int rua; int avenida; int pizzas; int i; for (i = 0; i < n; i++) { scanf("%d %d %d", &rua, &avenida, &pizzas); avenidas[avenida] += pizzas; ruas[rua] += pizzas; } int a = 7; printf("%d %d\n", avenida[a], rua[0]);}
s.cpp:25:30: error: invalid types ‘int[int]’ for array subscripts.cpp:25:38: error: invalid types ‘int[int]’ for array subscript
avenida and rua are ints.avenidas and ruas are the arrays.Edit: I compiled a corrected version and it works. So what is this code doing, exactly?