For the variable pettoremove, I can't get the scanf to work and the program doesn't work if I don't preset pettoremove a number. That number never changes, and I don't know why and I can't make it work. Is it because it's in a look, I have to use pointers somehow?
Code:void deletepet(pet petarray[], int numberofpets) { int pettoremove=9; int validentry=0; while (validentry==0) { printf("Enter the number of the pet you want to remove from the archive: "); fflush(stdin); scanf("&d", &pettoremove); printf("%d\n", pettoremove); printf("%d\n", numberofpets); if (pettoremove<=numberofpets) { printf("That's totally a valid entry\n"); validentry=1; } else { printf("That's not a valid entry\n"); } } printf("So I made sure bad stuff won't happen, now CODE MOAR STUFF HERE\n"); }



1Likes
LinkBack URL
About LinkBacks



