I tried to fix it but it keeps going into a loop saying "Invalid Input" and the end even though I put a break; I cannot figure out what it is, can anyone help?
#include <stdio.h>
#include <stdlib.h>
int main(int argc, const char * argv[]) {
int *ptr1, *ptr2;
int num, num2, product, sum, quotient;
ptr1 = #
ptr2 = &num2;
char *c;
char choice;
//p = malloc (sizeof(num));
//c = malloc (sizeof(choice));
//-----------------------------------------------------------
//Inputs/Intro Statements
//------------------------------------------------------------
ptr1 = malloc (sizeof(*c));
ptr2 = malloc (sizeof(choice));
printf("Enter your two integers:\n");
scanf("%d", &num);
printf("Enter another integer: \n");
scanf("%d", &num2);
printf("Now, enter a or A to show the sum, p or P to show the product or d or D to show the division of the first by the second:\n");
scanf("%c", &choice);
c = &choice;
//------------------------------------------------------------
do {
switch(choice) {
case 'A': //addition function
sum = *ptr1 + *ptr2;
printf("The sum of the tewo intergrs are: &sum /n");
break;
case 'P': //product
product = *ptr1 * *ptr2;
printf("The product of &num & &num2 are: &product /n");
break;
case 'D': //division
quotient = *ptr1 / *ptr2;
printf("The quotient of &num & &num2 are: "ient \n");
break;
case 'Q': //quit
printf("Goodbye");
break;
default: //just in case something goes wrong
printf("Invalid Input\n");
break;
}
}while (choice!= 'Q');