...
Non-Compliant Coding Example
Code Block | ||
---|---|---|
| ||
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(void) {
char *pwd = getenv("PWD");
printf("pwd = %s.\n", pwd);
char *home = getenv("HOME");
printf("pwd = %s.\n", pwd);
printf("home = %s.\n", home);
// see if home is the same as pwd
if (strcmp(pwd, home) == 0) {
puts("pwd and home are the same.\n");
}
else {
puts("pwd and home are NOT the same.\n");
}
return 0;
}
|
Compliant Solution
Code Block | ||
---|---|---|
| ||
...