I've not seen a lot of material on this. I've seen people attempting to bring a C++ program back to C++ code, and claiming how hard it is, but C code from C++ program? I don't know.

If it is possible, what obstacles would be in the way? If impossible, what particular features make it so?

  • Why would you want to do that? Jan 30 at 4:34
  • @RolfRolles I am more familiar with C. I am not certain the exact language this program was written in, but others suggest it was C++. If possible, I'd like to stay within my realm of knowledge. If doing this is not possible... I will simply have to expand my realm.
    – Luke Dunn
    Jan 30 at 8:00

2 Answers 2


If you're asking whether it's possible for an automated decompiler to produce C code as output for a given C++ input binary (rather than producing C++ code as output), the answer is that most decompilers are going to do this anyway, and are not going to give you a choice as to which language they produce as output. Machine-code decompilers generally produce a C-like pseudocode, which, in general, cannot be immediately recompiled to C code. A better question would be "to what extent can the C-like pseudocode produced by decompilers represent features of C++ that are not in C", to which the answer depends on the specific decompiler in question.

If you're asking whether it's possible to manually decompile a C++ program into a C program, the answer is yes. Just as you can take a program written in C++ and manually translate it into C, you can manually decompile a binary into any language you want. There's going to be a lot of manual work regardless of which language you choose to decompile the program into. Although C and C++ are not the same language, the first C++ compilers worked by translating C++ code into C code, and using a regular C compiler on the result (see: CFront https://en.wikipedia.org/wiki/Cfront). You can simulate most C++ constructs in C, although it's going to be a lot more work than simply taking advantage of the features introduced by C++.


Of course, yes. Here, the problem is that you need to know well about the difference between c and c++ from the viewpoint of reversing, I suppose. For example, the c++ classes is converted to assem codes like c structure, and the virtual table of a class is converted a first member of a structure and other functions is converted like a regular functions. And the pointer of c++ class is converted a certain register like a "ecx" register in x84 assem code. If you know somethings like this, you can decompile c++ program to c.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.