3. Write a c program to delete the all consonants from given string.
9. Write a c program to print the string from given character.
10. Write a c program to reverse a string
11. Reverse a string using recursion in c
12. String concatenation in c without using strcat
13. How to compare two strings in c without using strcmp
14. String copy without using strcpy in c
15. Convert a string to ASCII in c
10. Write a c program to reverse a string
11. Reverse a string using recursion in c
12. String concatenation in c without using strcat
13. How to compare two strings in c without using strcmp
14. String copy without using strcpy in c
15. Convert a string to ASCII in c
15 comments:
It was i think a bit lengthy method..
you could have used for loop..
To concatenate two string you can use function : strncat
It has been defined inside string.h
i am stisfied with your explanation.
could u pls tel me how to do widout usin puts n gets??????
i am satisfied...
Thanks...i am satisfied......
void main()
{
char str1[30], str2[10];
int i, j;
clrscr();
printf("Enter first string: ");
gets(str1);
printf("Enter second string: ");
gets(str2);
for(i = 0; str1[i]; i++); // to find null of str 1
for(j = 0; str2[j]; j++)
str1[i+j] = str2[j];
str1[i+j] = 0;
printf("The concatenated string is %s\n", str1);
getch();
}
char array2[250], array1[250]="hellobrother";
int i,j=0;
for(i=5;i<=250;i++)
{
array2[j]=array1[i];
j++;
}
puts(array2);
//using pointer for
char str2[250]="how r u felling today";
char *ptr=str2;
int i,j;
printf("%u \n",ptr);
while(*ptr!='f')
{
ptr++;
}
printf("%u \n",ptr);
for(int x=0;ptr[x]!='\0';x++)
{
printf("%c",ptr[x]);
}
write
#include
#include
void main()
{
int i=0,j=0;
char str1[20],str2[20];
puts( "Enter first string=");
gets(str1);
puts( "Enter second string=");
gets(str2);
while (str1[i]!='\0')
{
i ;
}
while (str2[j]!='\0')
{
str1[i ]=str2[j ];
}
str1[i]= '\0';
puts(str1);
getch();
}
I have a doubt that in d 2nd while loop if we have done str2[j++] then how would the first character of str2 be included in str1
I have a doubt that in d 2nd while loop if we have done str2[j++] then how would the first character of str2 be included in str1
Post a Comment