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

any restrictions have on the number of 'return' statements that may be present in a function. a) no restriction b) only 2 return statements c) only 1 return statements d) none of the above

0 Answers  


What is keyword in c?

0 Answers  


hi folks i m approching for h1 b interview on monday 8th of august at montreal and i m having little problem in my approval notice abt my bithdate my employer has made a mistake while applying it is 12th january and istead of that he had done 18 the of january do any body have any solution for that if yes how can i prove my visa officer abt my real birthdate it urgent please let me know guys thaks dipesh patel

0 Answers  


Explain what is the benefit of using const for declaring constants?

0 Answers  


What is an operator?

0 Answers  


What is .obj file in c?

0 Answers  


What is pre-emptive data structure and explain it with example?

0 Answers  


What is time null in c?

0 Answers  


how can I convert a string to a number?

0 Answers  


What is a memory leak in structures? How can we rectify that?

2 Answers  


Does c have function or method?

0 Answers  


What is unsigned int in c?

0 Answers  


Categories