Write a program that accepts a string where multiple spaces
are given in between the words. Print the string ignoring
the multiple spaces.
Example:
Input: “ We Are Student “
Output: "We Are Student"
#include<stdio.h>
main()
{
char *p, *q, *q1;
p = (char *)malloc(200);
q = (char *)malloc(200);
q1 = q;
printf("ENTER THE SENTENCE: \n");
p = gets(p);
while(*p != '\0')
{
if(*p != ' ' || *(q -1) != ' ')
{
*q++ = *p++;
}
else
p++;
}
*q = '\0';
printf("%s", q1);
getch();
}
| Is This Answer Correct ? | 0 Yes | 0 No |
What is array within structure?
What does c value mean?
What is selection sort in c?
How is pointer initialized in c?
What is a macro?
how can i sort numbers from ascending order and descending order using turbo c..
The differences between Windows XP and Windows Visa
which type of question asked from c / c++ in interview.
What is the need of structure in c?
Write a function which takes as parameters one regular expression(only ? and * are the special characters) and a string and returns whether the string matched the regular expression.
how to generate sparse matrix in c
What happens if header file is included twice?