Files
.obsidian
.stfolder
IT
education
calculus
computer engineering
ECE1400
(not) Chapter 11 Exercises.md
C.md
Chapter 11 Exercises.md
Chapter 12 Exercises.md
Chapter 13 Exercises.md
Chapter 14 Exercises.md
Chapter 15 Exercises.md
Chapter 16 Exercises.md
Chapter 17 Exercises.md
Chapter 2 Exercises.md
Chapter 3 Exercises.md
Chapter 4 Exercises.md
Chapter 5 Exercises.md
Chapter 6 Exercises.md
Chapter 7 Exercises.md
Chapter 8 Exercises.md
Chapter 9 Exercises.md
Flowcharts and Pseudocode.md
ECE1410
ECE2700
english
Ohm's Law.md
math
nutrition
statistics
notes
personal
software
..gitignore.un~
.gitignore
.gitignore~
notes/education/computer engineering/ECE1400/Chapter 14 Exercises.md
2025-01-07 18:14:44 -07:00

1002 B

12. Suppose that the macro M has been defined as follows:

#define M 10

Which of the following tests will fail?

// C will fail, because `M` is defined.
#ifndef M

// E will fail, because `M` is defined
#if !defined(M)

13. Show what the following program will look like after preprocessing. You may ignore any lines added to the program as a result of including the <stdio.h> header.

#include <stdio.h>

int main(void)
{
	f();
	
}

 void f(void) {
	printf("N is %d\n", 100);
 }

15. Suppose that a program needs to display messages in either English, French, or Spanish. Using conditional compilation, write a program fragment that displays one of the following three messages, depending on whether or not the specified macro is defined.

#ifdef ENGLISH
#define MESSAGE "Insert Disk 1"
#endif

#ifdef FRENCH
#define MESSAGE "Inserez Le Disque 1"
#endif

#ifdef SPANISH
#define MESSAGE "Inserte El Disco 1"
#endif

printf(MESSAGE);