Blogger Tips And Tricks|Latest Tips For Bloggers Free Backlinks

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".
 
          

0 comments:

Post a Comment