Question: I am looking at the following line of c++ code, where "zlib.h" is included

```
int err = compress2(compressed.get(), &dest_len,
                            reinterpret_cast<const unsigned char *>(plain_text.c_str()),
                            source_len, 9);

```

I am trying to undo this compression using C#. I figure I should use a C# library because writing my own decompression algorithm seems wasteful and difficult.
The library I have seem recommended is SharpZipLib (even by Mark Adler himself!)
However, it seems like compress2 with these args is using a preset dictionary. Here is my attempt at decompressing:

```
Inflater inflater = new Inflater(false);
inflater.SetInput(bytes);
int ret = inflater.Inflate(outBuffer, 0, 2047);
if (ret == 0)
{
    Console.WriteLine(inflater.IsNeedingDictionary);
    Console.WriteLine(inflater.IsNeedingInput);
    Console.WriteLine(inflater.Adler);
}

```

This says it needs a dictionary. I know how to set the dictionary, but I am clueless about how to set it based on the zlib.h compress function. **How can I create the necessary preset dictionary to decrypt?**

Notes:
Here is the line of code I am trying to essentially replicate in C#

```
int err = uncompress(uncompressed.get(), &dest_len, plain_text.get(), src_len);

```

Where uncompressed is empty, dest len is simply 4\*src\_len, and src\_len is compressed length. Compressed text stored in plain\_text.

Here are the detected first 2 bytes in my C# program:
78 3f
(0111 1000 0011 1111)

Someone indicated that this doesn't make sense given the compress2 code given...

Sorry for any mistakes in my question, I haven't asked many questions on here.

Answer: 
`int` and `const int` are compatible as everywhere an int is expected (eg as a function parameter) a `const int` can be given. And, importantly, vice versa. The `const` and `volatile` only affect the variable, not the value.

That is **not** the case for `int*` and `const int*`. If a function requires an `int*` you can *not* supply a `const int*`. If you try that you will get an 'incompatible types' error. For pointers the `const` and `volatile` refer to the *value*, not the variable. (In most cases, it depends on where you put the `const`)

And your "workaround" just derefences the pointer so it gets rid of the pointer, so it ultimately answers a different question. It determines if the types pointed to are compatible, which is different from the pointer type itself.
In my opinion，type T1 is ompatible with type T2 means when you have two variable T1 a and T2 b, then you can assign a = b and at the same time b = a.