- Trending Categories
- Data Structure
- Operating System
- C Programming
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What are memory operations in C language?
45 Lectures 4.5 hours
66 Lectures 5.5 hours
The library #include <memory.h> contains the basic memory operations. Although not strictly string functions, the functions are prototyped in #include <string.h>.
These memory operations are as follows −
|void *memchr (void *s, int c, size_t n);||Search for a character in a buffer.|
|int memcmp (void *s1, void *s2, size_t n);||Compare two buffers.|
|void *memcpy (void *dest, void *src, size_t n);||Copy one buffer into another.|
|void *memmove (void *dest, void *src, size_t n);||Move a number of bytes from one buffer to another.|
|void *memset (void *s, int c, size_t n);||Set all bytes of a buffer to a given character.|
Note that in all case to bytes of memory are copied. The sizeof() function comes in handy again.
|memcpy(dest, src, SIZE);||Copy chars (bytes)|
|memcpy(idest, isrc, SIZE*sizeof(int));||Copy arrays of ints|
memmove() behaves in exactly the same way as memcpy() except, that the source and destination locations may overlap.
memcmp() is similar to strcmp() except here, unsigned bytes are compared and returns less than zero if si is less than s2 etc.
char src[SIZE], dest[SIZE]; int isrc[SIZE], idest[SIZE];
- What are the shift operations in C language?
- What are the different operations on files in C language?
- What are different pointer operations and problems with pointers in C language?
- What are file operations in C#?
- Explain the Character operations in C language
- Explain Arithmetic operations using pointers in C language?
- What are nested structures in C language?
- What are string literals in C language?
- What are macros in C programming language?
- What are executable statements in C language?
- What are relational operators in C language?
- Example program on Dynamic memory allocation in C language
- What are Memory Reference Instructions?
- What are the FTP Operations?
- What are Arithmetic Micro-operations?