I want to make a sort of food ordering system, but whenever I try to make the ID increment by 1 every loop, it doesn't work. It just shows the number 6684076, no matter what.
Here's the code:
struct res {
char nome[40];
char endereco[100];
char pedido[200];
char valor[20];
};
int main() {
char M[100];
int c;
int menu;
int cod = 0;
while (cod < 100) {
cod = cod + 1;
struct res R1, R2, R3, R4;
printf("Digite seu nome: \n");
gets(R1.nome);
fflush(stdin);
printf("Digite seu endereco: \n");
gets(R2.endereco);
fflush(stdin);
printf("Digite seu pedido: \n");
gets(R3.pedido);
fflush(stdin);
printf("Digite o valor total que vai pagar: \n");
gets(R4.valor);
fflush(stdin);
system("cls");
c = c + 1;
printf("Codigo: %d\n", &c);
printf("Nome: %s\n", R1.nome);
printf("Endereco: %s\n", R2.endereco);
printf("Pedido: %s\n", R3.pedido);
printf("Valor: %s\n", R4.valor);
}
return 0;
}