I have a course in c from the university and we are required to use the scanf_s function. I've started writing a code for my first assignment and the scanf_s doesn't seem to work. It seems the program just ignores that line where I wrote scanf_s("%c", &mathOparation, 1);
I would be happy if anyone can explain why.
My code:
#include <stdlib.h>
#include<math.h>
int main()
{
    int choise; // the selection the user chooses from the list below
    printf("please choose from the selection below the secrtion you want:\n ");
    printf("1.standard calculator\n");
    printf("2.Bitwise shoft calculator\n");
    printf("3.pascal's triangle\n");
    printf("0.to exit\n");
    printf("enter a number between 1-3\n");
    scanf_s("%d", &choise);
    switch (choise)
    {
    case 1://the basic calculator
    {
        double num1=0, num2=0;// the 2 numbers which we will use the oparation on
        char mathOparation;// the oparation the user needs to choose
        printf("what would you like to do '+' ,'-','*','/' \n");
        scanf_s("%c", &mathOparation, 1);  
        printf("please enter the 2 numbers you want to operate on:\n");
        scanf_s("%lf%lf", &num1, &num2);
        switch (mathOparation)
        {
        case '+':
            printf("%lf", num1 + num2);
            break;
        case '-':
            printf("%lf", num1 - num2);
            break;
        case '*':
            printf("%lf", num1 * num2);
            break;
        case '/':
            printf("%f", num1 / num2);
            break;
        default:
            printf("error");
            break;
        } 
    } 
    default:
        printf("error please try again");
        break;
    }
    return 0;
}
 
    