-
-
Save Pavelovich/07d4a1cf6fface3fe583 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int askInt(char *question[200]) | |
{ | |
int number; | |
printf(question); | |
scanf("%d", &number); | |
printf("The number is %d \n", number); | |
return number; | |
} | |
char askChar(char *question[200]) | |
{ | |
char text[200]; | |
printf(question); | |
scanf("%s", text); | |
printf("The string is: %s \n", text); | |
return text; | |
} | |
double askDouble(char *question[200]) | |
{ | |
double number; | |
printf(question); | |
scanf("%lf", number); | |
printf("The number is %lf \n", number); | |
return number; | |
} | |
int main(int argc, char *argv[]) { | |
askInt("Enter a number: "); | |
askChar("Enter a string: "); | |
askDouble("Enter another number: "); // Segmentation fault after the input for this | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment