Thread: Is C like C++ ?

  1. #1
    Registered User
    Join Date
    Jun 2010
    Posts
    8

    Is C like C++ ?

    Someone told me that 97% of C++ is same as C, is that true ?? That same person told me that hackers use C language for most of their work 0.0 i dont know if thats true or not.

    I have a question:
    In C programming is there a way to open a website in the program ?? i mean like i dont want the website to open in a web browser, i want it to be in the program box....get it ?

    Anyways what do you think is the most powerful programming language ? which language allows you to do nearly everything you want (i dont know if there is a language which allows you to do that xD)

    Thanks!

  2. #2
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    No. C++ is like C.


    Quzah.
    Hope is the first step on the road to disappointment.

  3. #3
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Quote Originally Posted by begin View Post
    Someone told me that 97% of C++ is same as C, is that true ??
    No. But they are far more alike than any other two languages I'm aware of. Basically, C++ includes C (but C does not include C++).

    That same person told me that hackers use C language for most of their work 0.0 i dont know if thats true or not.
    "Hacking" just refers to a style of solving problems, it is not language specific.

    In C programming is there a way to open a website in the program ?? i mean like i dont want the website to open in a web browser, i want it to be in the program box....get it ?
    Anything you see happen on a computer can be done in C/C++. I promise. That does not mean it will be easy.

    Anyways what do you think is the most powerful programming language?
    which language allows you to do nearly everything you want (i dont know if there is a language which allows you to do that xD)
    They'll both allow you to do whatever you want. "Powerful" is a sort of ambiguous concept, C is a powerful language, but I would say there is more "powerful" syntax available in C++. However, in that sense (syntactical power), most high level interpreted languages (perl, python, php) have even more "powerful" syntax available to them. Just those languages are not as fast as C/C++, which are generally considered the fasted of all languages.

    Thanks!
    You're welcome. I'm kind of in a minority with this opinion, but I recommend if you're interested, you start with C, and then if you find C++ appealing to you later, you can always switch to that, and your time spent with C will not be wasted.
    Last edited by MK27; 06-17-2010 at 02:49 PM.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  4. #4
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    C++ and C are different languages. They do stuff in different ways. So the first statement is untrue.
    Second question, yes, of course there is. How do you think web browsers were made? If you want to actually know more specifics, then I would suggest a new thread about it.
    Thirdly, there is no such thing as best or most powerful because it all depends on what you want to do and different languages have different strengths and weaknesses. There is no language that has all the advantages and none of the disadvantages.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  5. #5
    Master Apprentice phantomotap's Avatar
    Join Date
    Jan 2008
    Posts
    5,108
    That same person told me that hackers use C language for most of their work
    That's crap. The best hacker I know uses only Python. I only know one or two that use C, and that's because they are kernel hackers.

    More importantly, who cares what other people use? What do you want or intend to use? That's the language you should be worried about. Well, unless it is Erlang... then you may just want to kill yourself.

    which language allows you to do nearly everything you want
    None of them. ;_;

    There is no language that has all the advantages and none of the disadvantages.
    You've obviously never heard of Whitespace.

    Soma

  6. #6
    Third Eye Babkockdood's Avatar
    Join Date
    Apr 2010
    Posts
    352
    C and C++ are very similar. You can change a C source file's name from "prog.c" to "prog.cpp" and it will compile. Most of the time.

  7. #7
    Registered User claudiu's Avatar
    Join Date
    Feb 2010
    Location
    London, United Kingdom
    Posts
    2,094
    Quote Originally Posted by Babkockdood View Post
    C and C++ are very similar. You can change a C source file's name from "prog.c" to "prog.cpp" and it will compile. Most of the time.
    Actually that is not true at all, most of the times you have to change at least the header names (stdio->cstdio), add "type safety" to your operations as required by C++, etc.
    1. Get rid of gets(). Never ever ever use it again. Replace it with fgets() and use that instead.
    2. Get rid of void main and replace it with int main(void) and return 0 at the end of the function.
    3. Get rid of conio.h and other antiquated DOS crap headers.
    4. Don't cast the return value of malloc, even if you always always always make sure that stdlib.h is included.

  8. #8
    Registered User
    Join Date
    May 2010
    Location
    Naypyidaw
    Posts
    1,314
    C99 and C++ are totally different.

  9. #9
    Registered User
    Join Date
    May 2010
    Posts
    81
    My opinion: Someone must start from C and then go to C++, orelse it will be somehow dificult for him to learn the C programming...also c is very powerfull language and the only serious reason that sb could go to C++ is only for the graphics..

  10. #10
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Absolute nonsense. C++ is just as powerful as C. Indeed, one could argue that it's even more powerful seeing as it supports all that C does and more. So that argument is nullified.
    In fact, let me point out that it is better to use C++ for desktop application than C most of the time because it will usually result in shorter development time, less bugs and security vulnerabilities. Because C was not designed for that. It was more designed for environments where memory is scarce and performance is critical.
    And learning C before C++ is just sure to cause confusion. No, a better way would be to learn C++ and then slowly go into low-level C++ which basically teaches memory management.
    In other words, it is better to avoid C unless you are very familiar with it (or unless you doing it for education purposes) in all places where it isn't required. C++, Java, C#, your favorite high-level language here, are usually better tools for the job.
    Last edited by Elysia; 06-18-2010 at 04:48 AM.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  11. #11
    Registered User claudiu's Avatar
    Join Date
    Feb 2010
    Location
    London, United Kingdom
    Posts
    2,094
    I think computability theory and the Church-Turing thesis teaches us that power has nothing to do with any of this. Perhaps expressibility is a better term for what was being argued here. As for power, none of these languages are more "powerful" since you can write a compiler for the other in any of them, hence there is nothing that can be done in one but not the other, although the way it is being done is substantially different.
    1. Get rid of gets(). Never ever ever use it again. Replace it with fgets() and use that instead.
    2. Get rid of void main and replace it with int main(void) and return 0 at the end of the function.
    3. Get rid of conio.h and other antiquated DOS crap headers.
    4. Don't cast the return value of malloc, even if you always always always make sure that stdlib.h is included.

  12. #12
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Quote Originally Posted by Elysia View Post
    In fact, let me point out that it is better to use C++ for desktop application than C most of the time because it will usually result in shorter development time, less bugs and security vulnerabilities. Because C was not designed for that.
    Only if C++ programmers are behind it I think that is what C was not designed for. I'll agree the development time is less.

    Quote Originally Posted by claudiu View Post
    Actually that is not true at all, most of the times you have to change at least the header names (stdio->cstdio)
    Actually you don't, that's just convention. The mainstream seem to rail against this, but you can use as little C++ in a C++ program as you like. I still think it's better to study C a bit first, because you probably won't learn it at all otherwise, and IMO some of the C syntax and standard functions are better than their C++ equivalents. Of course they may be dangerous in the wrong hands.
    Last edited by MK27; 06-18-2010 at 07:41 AM.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  13. #13
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    begin, I think that your questions have more or less been answered, and any more on this "is C like C++" aspect will turn it into a "C versus C++" language war. As such, I will be closing this thread soon.

    The part that perhaps has not been fully addressed is:
    Quote Originally Posted by begin
    In C programming is there a way to open a website in the program ?? i mean like i dont want the website to open in a web browser, i want it to be in the program box....get it ?
    I echo MK27's answer of yes, except that you would effectively be writing a web browser.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

Popular pages Recent additions subscribe to a feed