...
| Code Block | ||
|---|---|---|
| ||
FILE *fptr = fopen(file_name, "w");
if (fptr == NULL) {
/* Handle Error */
}
int c = 'a';
while (c <= 'z') {
putc(c++, fptr);
}
|
The c++
...
is perfectly safe, since putc() guarantees to evaluate its character argument exactly once.
This example only illustrates the side-effect issue. The output will differ depending on the character set.
...