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

Answers were Sorted based on User's Feedback



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

Answer / 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

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

Answer / aravind

int main()
{
int i;
char str[10];
gets(str);
for(i=0;i<=number;i++)
{
if(str[i]==' ')
str[i]=0;
}
printf("string without white space is=%s",str);
}

Is This Answer Correct ?    0 Yes 3 No

Post New Answer

More C Interview Questions

Why do we use int main instead of void main in c?

0 Answers  


What is an example of structure?

0 Answers  


Taking an example,differentiate b/w loader and linker ?

1 Answers  


Explain is it better to bitshift a value than to multiply by 2?

0 Answers  


to get a line of text and count the number of vowels in it

3 Answers   Satyam,






What does *p++ do?

0 Answers  


any function have arguments one or more OR not . it is compulsary a) any function compulsary have one or more arguments b) any function did not have arguments. It is not compulsary c) it is optional it is not compulsary d) none of the above

0 Answers  


Tell me the use of bit field in c language?

0 Answers  


What is default value of global variable in c?

0 Answers  


What is the relation between # and include<stdio.h>

5 Answers   HCL,


what is the meaning of java that is (J A V A) full form of JAVA

71 Answers   AKS University, Bhel, BNL, BPO, HCL, Peacecon,


Can stdout be forced to print somewhere other than the screen?

0 Answers  


Categories