www.hitechskill.com said:
HiTechSkill.Com offers free information, tests, and sample interview
questions that will help
to improve your information technology skills.
http://www.hitechskill.com
500 C sample Programs! Let the corrections begin!
/* program no : 1 */
/* purpose : display the message */
/* date of written : 14/12/2004 */
#include <stdio.h>
void main()
{
printf("%s"," welcome to c programming writting");
}
/*************************/
1. void main is a nonportable type for main.
Code like this needs to say what implementation it's for.
2. main, defined with empty parentheses
is an obsolecent feature of the language.
3. A text stream that doesn't end in a newline character
is nonportable, and printf with a %s,
is a slightly overconvoluted way of outputting
a that particular string litteral.
4. There's no return statement, which is allowable in C99,
but not C89.
/* program no : 2 */
double radius=0.0,area;
printf("%lf", area);
1. All the same problems as program number 1 and more.
2 %lf is allowed in C99 as the format specifier for double,
but the right printf format specifier for double in both
C89 and C99, is %f.
/* program no : 3 */
1. All the same problems as program number 2.
Skipping past all the nearly identical programs to ...
/* program no : 22 */
/* purpose : read and print upper to lower */
printf("%c", any+32);
1. All the same problems as program number 1 plus
2. A program that has the stated purpose of this one,
really really should show how to use the tolower function.
"Basic (50 programs)" is a bad choice of names,
for a link to a list of 25 programs.
"While Loops(100 programs)" and "For Loops(100 programs)"
have all the same problems repeated over and over.
At this point, I'm assuming that all the programs
have at least all the same problems as program number 1.
/* program no : 231*/
getch();
getch isn't part of standard C and there's an apparent typo
which causes no files to be #included.
These four links are all the same:
Functions (50 programs)
Pointers (100 programs)
Files(100 programs)
Unix Commands(25programs)