Blogger Tips And Tricks|Latest Tips For Bloggers Free Backlinks

Monday, 19 November 2012

Write a program to memory set memset() function in C language examples?

memset(),memory set,memset() function, memory set function,memset() in C,memory set in C,program to memory set function,program to memset() function,Write a program to memory set memset() function in C language,memset() in c language


memset() function

              To set all bytes in a block to a particular value,by use memset() function.

     Syntax

               void *memset(void destination,int set_value,size_t count);

   Program

                   #include<stdio.h>
                    char a[100] = "God gift programming";
                   main()
                   {
                         memset(a+2,'*',10);
                  
                         printf("After memset : %s\n",a);

                    }

              Output
                            After memset :  Go**********gramming
        In this case,from a[2] position to 10 positions are overlapped with *.i.e. memset().

                           

Sunday, 18 November 2012

Write a program to memory move memmove() function in C language examples?

memmove(),memory move,memmove() function, memory move function,memmove() in C,memory move in C,program to memory move function,program to memmove() function,Write a program to memory move memmove() function in C language,memmove() in c language




 memmove() function

                   It copies the number of bytes from located pointed of source and it again copied into the located point of destination,In this case,the overlap will be occurring in the destination. i.e memmove() function.

syntax
              void *memmove(void *destination,void *source,size_t count);

 Program
            
                 #include<stdio.h>
                 main()
                 {
                       char str[] = "Programming";
             
                            memmove(str+1,str+3,4);

                     printf("After memory move  : %s\n",str);
                  }

    Output
                  After memory move :Pgramamaing

         Explanation 
                                 a[0]   1   2   3   4   5   6   7   8   9   10
                                   P     r    o   g    r    a   m  m   i   n     g
                    In memmove(str+1,str+3,4) function,from a[3] position to 4 bytes (a[6]) are copied and overlapped in destination string.So output is Pgramamaing. 

            

Saturday, 17 November 2012

Write a program to memory copy memcpy() function in C language examples?

memcpy(),memory copy,memcpy() function, memory copy function,memcpy() in C,memory copy in C,program to memory copy function,program to memcpy() function,Write a program to memory copy memcpy() function in C language,memcpy() in c language


 memcpy() function

      It copies the bytes of data between memory blocks or buffers.This function doesn't care about the
              type of data being copied.
                    It simply makes an exact byte for byte copy.

               Syntax:- 
                               void *memcpy(void *destination,void *source,size_t count);
  Program

                  #include<stdio.h>
                  #include<string.h>
                  main()
                  {
                        char str1[100] = "This is string";
                        char str2[100];

                          memcpy(str2,str1,14);

                        printf("str2 = %s\n",str2);
                  }

       Output:-
                        str2 = This is string

     If you will give the 10 at the count(14),it copies only 10 bytes.It gives the o/p is "This is st".
 
          

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