MEMSET IN C++

Asked By 10 points N/A Posted on -
qa-featured

I am from Python and I am currently learning C ++. I learned a C / C ++ function called memset and found the compile time errors. When I give t in single quotes to print it gives repetitive t’s?

SHARE
Answered By 0 points N/A #318450

MEMSET IN C++

qa-featured

‘t’ is a character, while ‘t’ is a string and the strings end in a null terminator. This makes “t” a table composed not of one but of two characters – [‘t’, ‘\ 0’]! This makes the memset error more intuitive: it can easily convert a single character into an integer, but suffocates if it contains a bunch of characters. As in Python, int ([‘t’, ‘\ 0’]) (or ord ([‘t’, ‘\ 0’]) does not compute.  The correct syntax is:

void* memset( void* dest, int ch, std::size_t count );

Related Questions