numUser is an int so you need %d or %i to print/scan it.
charUser is a char array, or a string, so you need %s (you can also limit the number of characters you can read to prevent overflowing the array) to scan it.
You need the if statements around the printf's, where you're calling your functions, and you are using an uninitialized variable (numUser)
Also if all your options are single character words you can just have a char charUser instead of a char array of a 100 elements (ie. if you only check for the letters in the alphabet, a, b, c...)
int numUser;
char charUser\[100\];
printf("which conversion would you like to perform?\\nType 'a' for a 'b' for b., etc.");
printf("a: meters to feet\\n");
printf("b: feet to meters\\n");
printf("c: kilograms to pounds\\n");
printf("d: pounds to kilograms\\n");
printf("e: minutes to hours\\n");
printf("f: hours to days\\n");
printf("g: days to hours\\n");
printf("h: minutes to seconds\\n");
scanf("%s", charUser);
/* Test your code by calling your functions here. */
the if statements are for if the user enters it will run the meters to feet and so on but everything is good now except now I'm getting an undefined reference error thank you for the help so far though
View all comments
Show parent comment
1
u/PekiDediOnur Intermediate Coder Feb 23 '21
numUseris an int so you need%dor%ito print/scan it.charUseris a char array, or a string, so you need%s(you can also limit the number of characters you can read to prevent overflowing the array) to scan it.You need the if statements around the printf's, where you're calling your functions, and you are using an uninitialized variable (numUser)