There are three important differences between the C and the C++ programs
1. The C version passes the data structure to a function whereas the C++ version lists the object, then the method, and then any arguments to the method. For example, compare the C and C++ calls for pushing an element onto the stack:
C C++
stack_push(s, 1) s->push(1)

2. The C version calls new_stack and free_stack to acquire a stack struct and to release a stack struct. The C++ version invokes the new and delete operators to perform the same task. In C++, new and delete are reserved keywords. new allocates an object and delete destroys an object. new and delete replace C's malloc function (which allocates memory for an object) and C's free function (which de-allocates memory for an object. The format of the new operator is:
new classname(arguments)

new allocates an object that has enough space to store the class's instance variables. It then calls the class's initializer method and passes it the arguments. In this case the Stack initializer takes one argument, which is the size of the stack.
The format of the delete operator is:
delete objectname

delete first calls the destructor method associated with the object's class, then de-allocates the object's memory.
3. The C version has to prefix its function names with the prefix stack_, whereas the C++ version provides simple, concise names for its methods. The reason for the difference is that C++ does a better job of carving up the namespace so that name conflicts do not occur. The namespace of a program is the set of all global variable names, type names (i.e., struct, class, and typedef names) and function names declared in the program. In C all functions go into the same namespace so it is important ensure that function names that are likely to be popular (like push, pop, and top) are not multiply defined. The way to do this is to prefix function names that are associated with data structures with the name of the data structures. Hence we name push stack_push because it is associated with a stack. A side-benefit of this naming convention is that you can immediately tell whether or not a function is associated with a data structure, and if so, with which data structure it is associated.