• Home
  • Blog
  • Intro to C programming. 10 Questions

Intro to C programming. 10 Questions

0 comments

10 questions that asks you to fix C code with errors in them.

Example question (not the actual question):

The following program should detect if the user entered a vowel, but it isn’t working
correctly. Fix it so that it properly detects if a vowel was entered.
This program should be fixed such that no warnings or errors are produced. You can compile with -Wall to check all warnings.

int main() {

is_vowel = 1;

int char = a;

scanf(“%c”, char);

if (char = a) {

is_vowel = 1;
}

if (char == e) {

is_vowel = 1;
}

if (char == i) {

is_vowel = 1;
}

if (char == o) {

is_vowel = 1;
}

if (char == u) {

is_vowel = 1;
}

printf(“char is a vowel”, char);

}

About the Author

Follow me


{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}