How to removing white spces in c programming only bu using
loops

Answer Posted / ranj

Aravind has done few mistake in printing the no,
the correct format should like this

int main()
{
int i,number;
char str[10];
gets(str);
number=strlen(str);
printf("String without white space\n");
for(i=0;i<number;i++)
{
if(str[i]==' ');
else
printf("%c",str[i]);
}
}

Is This Answer Correct ?    5 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can we assign string to char pointer?

580


What do you mean by dynamic memory allocation in c? What functions are used?

650


Explain how can I remove the trailing spaces from a string?

621


Is this program statement valid? INT = 10.50;

686


What is modifier & how many types of modifiers available in c?

602






what are # pragma staments?

1621


Explain 'bit masking'?

646


Explain what is wrong with this program statement? Void = 10;

761


Explain threaded binary trees?

670


what is the height of tree if leaf node is at level 3. please explain

1593


What is file in c preprocessor?

646


Which header file is used for clrscr?

571


Why double pointer is used in c?

563


Can two or more operators such as and be combined in a single line of program code?

801


Why is not a pointer null after calling free?

587