Jump to content

Difference between c and c++

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
38 replies to this topic

#1
Chinmoy

Chinmoy

    Programming Expert

  • Members
  • PipPipPipPipPipPip
  • 392 posts
1. C does not have any classes or objects. It is procedure and function driven. There is no concept of access through objects and structures are the only place where there is a access through a compacted variable. c++ is object oriented.

2. C structures have a diferent behaviour compared to c++ structures. Structures in c do not accept functions as their parts.

3. C input/output is based on library and the prcesses are carried out by including functions. C++ i/o is made through console commands cin and cout.

4. C functions do not support overloading. Operator overloading is a process in which the same function has two or more different behaviours based on the data input by the user.

5. C does not support new or delete commands. The memory operations to free or alllocate memory in c are carried out by malloc() and free().

6. Undeclared functions in c++ are not allowed. The function has to have a prototype defined before the main() before use in c++ although in c the functions can be declared at the point of use.

7. After declaring structures and enumerators in c we cannot declare the variable for the structure right after the end of the structure as in c++.

8. For an int main() in c++ we may not write a return statement but the return is mandatory in c if we are using int main().

9. In C++ identifiers are not allowed to contain two or more consecutive underscores in any position. C identifiers cannot start with two or more consecutive underscores, but may contain them in other positions.

10. C has a top down approch whereas c++ has a bottom up approach.

11. in c a character constant is automatically elevated to and integer whereas in c++ this is not the case.

12. In c declaring the global variable several times is allowed but this is not allowed in c++.

God is real... unless declared an integer

my blog :: http://techarraz.com/


#2
Xav

Xav

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 13,118 posts
Love the signature, dude.
Jordan said:

Good members, like yourself, stick around and post for ages to come!
Mr. Xav | Blog | Forums

#3
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
Every time I see his signature, my math background kicks in: the integers are a subset of the reals, therefor declaring God an integer doesn't make him not real.
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#4
Xav

Xav

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 13,118 posts
Do you believe in God?
Jordan said:

Good members, like yourself, stick around and post for ages to come!
Mr. Xav | Blog | Forums

#5
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts

Xav said:

Do you believe in God?

Yes, and Jesus as described in the New Testament of the Bible.
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#6
Xav

Xav

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 13,118 posts
Cool. Sorry if I'm being too inquisitive.
Jordan said:

Good members, like yourself, stick around and post for ages to come!
Mr. Xav | Blog | Forums

#7
qiFhaM

qiFhaM

    Newbie

  • Members
  • Pip
  • 2 posts
Hi all... Im just newbie wan to learn this programming... But Im not sure which one is better for a newbie... Hope u all can help me... :confused:

#8
Xav

Xav

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 13,118 posts
Welcome to CodeCall! Actually, neither of them is better for a newbie. I suggest learning Visual Basic - there's an excellent book called Sams' Teach Yourself Visual Basic 2005 in 24 Hours. It's not a day job, but it makes things as simple as possible.
Jordan said:

Good members, like yourself, stick around and post for ages to come!
Mr. Xav | Blog | Forums

#9
qiFhaM

qiFhaM

    Newbie

  • Members
  • Pip
  • 2 posts
thx Xav...

#10
Xav

Xav

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 13,118 posts
You're welcome. :)
Jordan said:

Good members, like yourself, stick around and post for ages to come!
Mr. Xav | Blog | Forums

#11
Chinmoy

Chinmoy

    Programming Expert

  • Members
  • PipPipPipPipPipPip
  • 392 posts
Firstly, you CANNOT decide on starting a new language just like that. If you want to go for some application development with GUI and less botheration about the background coding, then maybe VB or smalltalk has something for you, but if you want to code for the first time, ui think c++ is the place to begin. It is easy, has the base syntaxes which are common to many other languages and has meanngful codes. So if someone would want to seitch from c++ to any other languager it would be easy but to start with VB, switching to other languages gives a hard time. Moreover with VB, youll never get to know issues of portability, memory management etc..

God is real... unless declared an integer

my blog :: http://techarraz.com/


#12
Xav

Xav

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 13,118 posts
Yes, but to begin with, I would recommend VB over C++ any day. The syntax is just so much easier to understand.
Jordan said:

Good members, like yourself, stick around and post for ages to come!
Mr. Xav | Blog | Forums