Whatrf is a "const void *src"

Todd Chester 666 Reputation points
2022-11-30T23:38:36.683+00:00

In the following:

https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/memcpy-s-wmemcpy-s?view=msvc-170
C
errno_t memcpy_s(
void *dest,
size_t destSize,
const void *src,
size_t count
);

What exactly is a "const void *src"?

C++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,787 questions
0 comments No comments
{count} votes

Accepted answer
  1. Minxin Yu 12,251 Reputation points Microsoft Vendor
    2022-12-01T02:13:25.08+00:00

    Hi, @Todd Chester

    const void *src

    You need to split it into two parts

    1. Pointer to Constant

    The address of pointers can be changed, but the value of the variable that the pointer points cannot be changed.

    E.g. const int* ptr;

    2 .void pointer

    A void* pointer can be converted into any other type of data pointer.

    Best regards,

    Minxin Yu


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.