0
My code that adds coordinates to an array does not work
My code does everything but what i want it to do #include <stdio.h> struct punto{int x; int y;}; typedef struct punto punto; int main(){ punto array[128]={}; int i=0; while(i<3){ printf("inserisci la x \n"); scanf("%d\n",&array[i].x); printf("inserisci la y \n"); scanf("%d\n",&array[i].y); i++;} }
1 Respuesta
0
On which basis, you are saying, it is not working..?
It is working for me, but you are not printing back results...
Edit:
#include <stdio.h>
struct punto{int x; int y;};
typedef struct punto punto;
int main(){
punto array[10]={};
int i=0;
while(i<3){
printf("inserisci la x \n");
scanf("%d\n",&array[i].x);
printf("inserisci la y \n");
scanf("%d\n",&array[i].y);
i++;}
i=0;
while(i<3){
printf("%d\n",array[i].x);
printf("%d\n",array[i].y);
i++; }
}