How to store different values with the same key in memcache?

How many bytes are needed to store each of the following values: 'n', "n", '\n', "\n", "\\n", "" ?

  • How many bytes are needed to store each of the following values: 'n', "n", '\n', "\n", "\\n", "" ? In a C++ program?

  • Answer:

    In C language 'n' is a character 1 byte "n" is a string 2 bytes which includes \0 '\n' is a character 1 byte "\n" newline plus null character 2 bytes "\\n" takes three bytes. \\ is taken as \, n, plus null character "" null character only in the string. So 1 byte.

Jada at Yahoo! Answers Visit the source

Was this solution helpful to you?

Other answers

1,2,1,2,3,1 all characters 'c' are size 1 all strings have extra 0 at the end so u add 1 the \\n is 2 characters + the extra 0 so 3

'n', in C++ it is one byte (in C it is an int 2 or 4 bytes) "n", 2 bytes 'n' and 0 '\n', one byte "\n", 2 bytes 10 ( new line ) and 0 "\\n", 3 bytes '\' ,'n', '\0' "" 1 byte 0 (or '\0' which is the same thing)

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.