Blogger Tips And Tricks|Latest Tips For Bloggers Free Backlinks
Showing posts with label C with strings. Show all posts
Showing posts with label C with strings. Show all posts

Saturday, 17 November 2012

Write a program to find the sub string in the main string using in C language examples?

Sub string in main string,sub string,sub string main string,find the sub string,sub string in main string using C,Write a program to find the sub string in the main string using in C language,program to sub string in main string,sub string program,C find sub string in main string,using C program language find sub string in main string


 Sub string in main string

                   See this video class for the good understanding of this concept and program .

Write a program to find the Reverse of the given string strrev() using pointers in C language examples?

Reverse of the string,string reverse,C string reverse,find string reverse,reverse of the string using pointers,find reverse of the string in C, Write a program to reverse of the given string using pointers in C language,string reverse program,find string reverse using pointers in C,find strrev()


 String Reverse

      The program is for reverse the given string in destination

                            #include<stdio.h>
                            void stringReverse(char *);

                            main()
                            {
                                  char source[100];

                                    printf("Enter String\n");
                                    scanf("%[^\n]",source);

                                       stringReverse(source);

                                      printf("After Reverse the string is : %s\n",source);
                             }
                             
                               void stringReverse(char *str)

                              {
                                            int len = 0,i=0;
                                            len = strlen(str);
                                             char *t = str + len - 1;
                 
                                          while(i < len/2)

                                               {
                                                     char temp = *str;
                                                     *str = *t;
                                                      *t = temp;
                                                     *str++;
                                                      *t-- ;
                                                      i++;
                                               }
                               }

                 Output:
                               Enter String
                                 Hello World
                                After Reverse the string :dlroW olleH

Write a program to find the copy of the given string strcpy() using pointers in C language examples?

Copy of the string,string copy,C string copy,find string copy,copy of the string using pointers,find copy of the string in C, Write a program to copy of the given string using pointers in C language,string copy program,find string copy using pointers in C,find strlcpy()


 String Copy

In this program,the given source string is copied into destination string.

                            #include<stdio.h>
                            void stringcopy(char *,char *);

                            main()
                            {
                                  char source[100],destination[100];

                                    printf("Enter String\n");
                                    scanf("%[^\n]",source);

                                       stringcopy(source,destination);

                                      printf("After copy the string is : %s\n",destination);
                             }
                             
                               void stringcopy(char *str1,char *str2)

                              {
                                                             
                                          while(*str1 != '\0')

                                               {
                                                     *str2 = *str1;
                                                     *str1++;
                                                      *str2++;
                                               }
                                     *str2 = '\0';
                               }

                 Output:
                               Enter String
                                 Welcome to C
                                After Copy the string : Welcome to C

Write a program to find the length of the given string strlen() using pointers in C language examples?

Length of the string,string length,C string length,find string length,length of the string using pointers,find length of the string in C, Write a program to find the length of the given string using pointers in C language,string length program,find string length using pointers in C,find strlen()


 String length

   The given program is for the find the length of the given string.

                           #include<stdio.h>
                            int stringlength(char *);

                            main()
                            {
                                  char source[100];
                                     int length;

                                    printf("Enter String\n");
                                    scanf("%[^\n]",source);

                                       length = stringlength(source);

                                      printf("The length of the string is : %d\n",length);
                             }
                             
                               int stringlength(char *str)

                              {
                                     int count = 0;
                   
                                          while(*str != '\0')

                                               {
                                                     *str++;
                                                       count++;
                                               }
                                   return count;
                               }

                 Output:
                               Enter String
                                 beonlyone
                                 The length of the string is : 9