#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main() {
int numcand;
char name[numcand];
int numregion;
int votes[numregion][numcand];
printf("Enter the number of candidates : ");
scanf("%d", &numcand);
for(int i=1; i<=numcand; i++){
printf("Enter the name of candidate #%d : ", i);
scanf("%s", &name[i-1]);
}
printf("Enter the number of regions : ");
scanf("%d", &numregion);
for(int i=0; i<=numregion; i++){
for(int j=0;j<=numcand; j++){
printf("Number of people who voted for %s : ", &name[i]);
scanf("%d", &votes[j][i]);
}
}
return 0;
}
in line 26 I used %s to print the the first array but it prints the first letter of the first name and the rest with it. for example if name #1 is dave, name#2 is sam, name#3 is juan. it will print dsjuan