Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/dipiert/the-pragmatic-programmer_my-exercises


https://github.com/dipiert/the-pragmatic-programmer_my-exercises

Last synced: 9 days ago
JSON representation

Awesome Lists containing this project

README

        

## Exercise 11
Your C program uses an enumerated type to represent one of 100 states.
You’d like to be able to print out the state as a string (as opposed to a
number) for debugging purposes. Write a script that reads from standard
input a file containing

```
name
state_a
state_b
:
:
```
Produce the file name.h, which contains

```
extern const char* NAME_names[];
typedef enum {
state_a,
state_b,
:
:
} NAME;
```

and the file name.c, which contains

```
const char* NAME_names[] = {
"state_a",
"state_b",
:
:
};
```