C Programming: The ultimate way to learn the fundamentals of the C language. by Harry. H. Chaudhary

C Programming: The ultimate way to learn the fundamentals of the C language. by Harry. H. Chaudhary

Author:Harry. H. Chaudhary. [H. Chaudhary., Harry.]
Language: eng
Format: azw3
Publisher: Sky Touch Con & Dev || Programmers Mind LLC NYC
Published: 2015-07-09T16:00:00+00:00


printf(“\n\nPress any key to exit…”);

getch();

}

3. WAP to input any string and delete the extra blanks spaces present in the same.

#include<stdio.h>

#include<conio.h>

#include<string.h>

main()

{

static char s1[50];

char s2[50];

char *s, *t;

int i, l;

printf(“Enter a string”);

gets(s1);

s=s1;

t=s2;

l=strlen(s);

for(i=0;i<=l-1;i++)

{

if(*s= = ‘ ’)/*check for a blank*/

{

if(*(s+1)!=' ')

{

*t=*s;

t++;

}

s++;

}

else

{

*t=*s;

t++;

s++;

}

}

*t='\0';

printf("Original Statement:%s\n",s1);

printf("Modified Statement:%s",s2);

getch();

}



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.