>scanf("%c", ans);
scanf takes a pointer, ans is not a pointer so you need to add the address of operator in front of ans and cover for the lameness of scanf by also reading the newline that it is sure to leave in the input stream:
scanf ( "%c%*c", &ans );
You'll also want to read the newline in just about every case of scanf in your program. Note that arrays don't need the address of operator when using them with scanf because the array name that you use is already a pointer.
>exit(0);
Use return to exit the main function. And the use of exit requires that you include stdlib.h.
Code:
#include <string.h>
#include <stdio.h>
#include <ctype.h>
main()
{
char buf[256];
char ans = '\0';
int pos;
do
{
printf("Please enter a word\n");
scanf("%s%*c", buf);
pos = strlen(buf) - strlen(".web");
if (0==strcmp(buf + pos, ".web"))
{
buf[pos]='\0';
strcat(buf, ".html");
printf("%s\n", buf);
}
printf("To enter another word type 'Y'\n");
scanf("%c%*c", &ans);
ans=(char)toupper(ans);
} while (ans=='Y');
return 0;
}
-Prelude