|
-
Dec 7th, 2002, 06:29 PM
#1
Thread Starter
New Member
pointers
can anyone see what is wrong with this code?
When I try to type a text with spaces and I expect the program to replace each space with three stars it does not do that?
the code is as Follows:-
#include<stdio.h>
#include<conio.h>
void main()
{
char *s,ch;
int i=0,j=0;
printf("Please input a line with text and spaces?\n");
do
{
ch=getchar();
s[i]=ch;
i++;
}
while(ch!='\n');
//**************
do
{
ch=s[j];
j++;
if( ch == 32)
printf("***");
else
printf("%c",ch);
}
while(ch!='\n');
getch();
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|