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
5 comments:
thank you it is helpful
My program on String concatenation in c without using strcat is not giving the desired output !
please tell why ?
here is my code
#include
#include
int main()
{
char str1[20], str2[20];
int i=0,ctr,length;
printf("Enter first string->");
scanf("%s",str1);
printf("Enter second string->");
scanf("%s",str2);
while(str1[i]!='\0')
{
ctr=i;
i++;
}
length=ctr+1;
//printf("\nThe lenght of string is->%d",length);
while(str2[i]!='\0')
{
str1[length]=str2[i];
i++;
length++;
}
printf("\nAfter concatenating in str1 ->%s",str1);
return 0;
}
But when i apply for loop(in second case ) its working! :-)
I think you need to clear the value of "i" before "while(str2[i]!='\0')"
for(....);
{
for(...)
{
..
...
}
...
}
Explain the execution
Post a Comment