Memcpy():-
memcpy() function copies n bytes from memory area src to memory area dest. The memory areas may not overlap
Syntax:
void *memcopy(void * destination, void *source, size_t count);
void *memcopy(void * destination, void *source, size_t count);
#include<stdio.h>
main()
{char str1[100]=”these is string”;
char str2[100];
memcpy(str2,str1,14);
printf(“%s”,str2);
}
Memmove():-
Syntax:
void *memmove(void *destination,void *source,size_t count);
void *memmove(void *destination,void *source,size_t count);
main()
{
char str[]=”programming”;
memmove(str+1,str+3,4); out put=gramramming.}
Memset():-
Syntax:
void *memset(void destination, int set_value,size_t count);
void *memset(void destination, int set_value,size_t count);
main()
{char arr[]=”god gift program”;
memset(arr+2,*,10);
printf(“%s”,arr); output-->=go**********gram.
}
Memcmp():-
memcmp() function
compares the first n bytes of the memory areas s1 and s2. It returns an integer
less than, equal to, or greater than zero if s1 is found, respectively, to be
less than, to match,...
Syntax:-
int memcmp(const void *s1, const void *s2, size_t n);
More details about C interview questions and programs: http://learnclanguage4.blogspot.com/
No comments:
Post a Comment