runner$ cat -n example0.c 1 /* Volume of a sphere of radius r */ 2 #include 3 #define pi 3.14159265358979; 4 int main() 5 { 6 double r, vol; 7 /* input the radius r */ 8 scanf("%lf", r); 9 /* calculate the volume */ 10 vol = (4/3)*pi*r*r*r; 11 /* print radius and volume */ 12 printf("Radius:%10.6f, Volume:%10.6f\n", r, vol); 13 return 0; 14 } runner$ lint -m -u example0.c (8) warning: variable may be used before set: r (10) error: cannot dereference non-pointer type statement has null effect (10) lint: errors in example0.c; no output created lint: pass2 not run - errors in example0.c runner$ cat -n example1.c 1 /* Volume of a sphere of radius r */ 2 #include /***************************/ 3 #define pi 3.14159265358979 /* NOTE: SEMICOLON DELETED */ 4 int main() /***************************/ 5 { 6 double r, vol; 7 /* input the radius r */ /********************/ 8 scanf("%lf", &r); /* NOTE: & INSERTED */ 9 /* calculate the volume */ /********************/ 10 vol = (4/3)*pi*r*r*r; 11 /* print radius and volume */ 12 printf("Radius:%10.6f, Volume:%10.6f\n", r, vol); 13 return 0; 14 } runner$ lint -m -u example1.c function returns value which is always ignored printf scanf runner$ cc -o example1 example1.c runner$ example1 1.0 Radius: 1.000000, Volume: 3.141593 (NOTE: WRONG ANSWER!) runner$ cat example2.c /* Volume of a sphere of radius r */ #include #define pi 3.14159265358979 int main() { double r, vol; /* input the radius r */ scanf("%lf", &r); /* calculate the volume */ /******************************/ vol = (4.0/3.0)*pi*r*r*r; /* NOTE: (4/3) NOW (4.0/3.0) */ /* print radius and volume */ /******************************/ printf("Radius:%10.6f, Volume:%10.6f\n", r, vol); return 0; } runner$ example2 1.0 Radius: 1.000000, Volume: 4.188790 runner$ example2 10.0 Radius: 10.000000, Volume:4188.790205