Plz help me tell me how we can convert the C program in C++ I working on OCX(Active X controls) plzzzzzzzzzzz...............reply

C++ is a superset of C so any C program can be compiled and run as a C++ program(doesn't change the fact that it is really C)

>C++ is a superset of C
Not really. A is only a superset of B if A contains everything in B (and optionally more). This isn't the case with C and C++, especially considering the evolutionary path of C since C++ was created. Rather, C++ is based on C, and not all C code will compile or run the same as C++.

>any C program can be compiled and run as a C++ program
BS. Here's a perfectly correct C program that 1) fails to compile as is in C++, and 2) is subtly broken in C++ if you fix the compilation error:

#include <stdio.h>
#include <stdlib.h>

int main ( void )
{
  int *p = malloc ( 10 * sizeof 'I' );
  int i;

  for ( i = 0; i < 10; i++ )
    p[i] = i;

  for ( i = 0; i < 10; i++ )
    printf ( "%d\n", p[i] );

  return 0;
}

Once again I say that converting C to C++ is harder than most people think, and unless the C code was written with C++ compatibility in mind, it's wise to be fluent in the differences between C and the C subset of C++.

>To quote Salem, it's a semantic, not syntactic, superset
Then don't mix up the two. Saying, and I quote, "any C program can be compiled and run as a C++ program" refers to syntactic compatibility. Claiming you really meant that C++ is a semantic superset contradicts your previous statements. In fact, C++ being a semantic superset is quite irrelevant to the original question, which is how to modify C code so that it compiles and runs correctly as C++, not how to compare the two languages in a debate among pedants.

Personally, I see "Well, C++ is a semantic superset, which is still a superset" as nothing more than a backpedaling trick for people to claim they aren't wrong when they make erroneous claims about C and C++ compatibility.

scanf("%s",B.Writer);

Edited 6 Years Ago by peter_budo: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks)

Practice the bitwise-LeftShift (<<) and bitwise-RightShift (>>) for the following values.
Num1=90;
Num2=45;
Num3=20;
Num4=80;
Num5=90;

This article has been dead for over six months. Start a new discussion instead.