C # and C ++ relative to C

I have never programmed using C or anything else, but I often use this site, as you can imagine that I stumble upon them quite a lot. And due to the fact that I really don’t understand the languages, this is a question that Google cannot answer.

So, in simple words, what are the differences between each of these languages. I assume they are interconnected. All I know is that C ++ is an object-oriented programming in C.

+4
source share
9 answers

They are loosely related to syntax.

In general, C ++ added a huge amount of features to C, mainly object orientation and general software constructs. However, he did it in such a way as to try to maintain the greatest compatibility with C.

C #, on the other hand, is a completely different animal. He completely abandoned all attempts to backward compatibility and is more trying to maintain a superficial syntactical similarity with C ++.

However, all three languages ​​are very unique, in practice. The development takes place differently in C and C ++ compared to C # due to the huge differences in the support of libraries and technologies.

+15
source

C is a grandfather. When you compile your C application, you get executable bytecode machine code that is ready to run on any platform compiled for.

C ++ object-oriented development in C added

C # is a distant relative, connected only with the help of somewhat similar syntax (and the letter C in the language name). C # compiles into .NET IL, which compiles Just In Time in the .NET runtime (like all other .NET language families).

+6
source

C # is not actually associated with C or C ++ separately from the name and using similar syntax. Under the covers, C # is completely different from C and C ++.

C # strongly inspired Java.

+4
source

C and C ++ are most similar to each other; C ++ is almost directly derived from C, adding new syntax and semantics to support object-oriented programming. Like C, it does not support native support much higher than basic streaming I / O; everything related to raster graphics, sound, network, etc., must be performed using third-party libraries. Programs in both languages ​​are usually compiled and executed as native machine code.

C # is much more like Java than C or C ++; like Java, it is usually compiled into bytecode that runs on a virtual machine, rather than native code, and, like Java, it tries to support everything that isn't in C and C ++. Java and C # look like C and C ++ at first glance (they use a lot of the same keywords, delimiters, etc.), but after playing with them for a while you realize that they are very different languages.

+3
source

Their names are similar because their syntax is similar.

C is perhaps the most different from the three. It is an efficient, high-level assembly language that can be compiled for multiple processor architectures. (Which assembly usually cannot)

+2
source

C++ provides many features in addition to the C language to help write object-oriented programs. Any OO program can easily be rewritten as non-OOP, even in C ++ or C #. OOP specific features:

  • function overload: int foo (int); and int foo (char);
  • operator overload
  • inheritance
  • polymorphism
  • (technically not OOP-only)
+1
source

C is the main programming language. This is great for low-level programming, and although you can do higher-level object-oriented programming (OOP) with it, it gets a little verbose when trying to do this. Great for embedded programming and when trying to make things very efficient.

C ++ basically took C and turned it into an object-oriented programming language. The syntax is slightly different, but overall very similar. This simplifies the execution of higher-level programming, but at the same time creates efficient code. Good for writing things like game engines. You need to be effective, but programming without OOP will be painstaking.

C #, IMO, the smallest, like the other two. It has a similar syntax, but almost complete OOP. This is good for writing .Net applications. This is useful for quickly writing graphical interfaces, both in Windows and in web development, in cases where efficiency is less important than trying to quickly enter the market.

0
source

Based on the background of C ++ after working in Windows-based applications in C ++ for about four years, and then, after switching to C #, I can say that C ++ and C # are very similar in syntax. However, C # has some cool reduction functions that are not available in C.

The biggest differences from my view are not the syntax, but rather the libraries, structure, or what you want to name, ignoring managed C ++. When you type in C ++ code, you usually have to decide which platform you are planning, as well as what types of libraries you plan to use. When I was working with C ++, I used the Microsoft Foundation libraries. However, there are many more options. In addition, with C ++ you have a lot more options to make which type of IDE you plan to use. With C #, you usually just use Visual Studio and the .Net framework, unless you are coding with Mono.

In addition, since C # uses a very rich .Net infrastructure, it is quite easy to start writing programs that are usually reserved for the gurus in the C ++ world. Of course, you also have the option of using managed C ++, which uses the .Net infrastructure, but I would have to ask: why?

I deliberately abandoned C from my discussion because I had never worked with him professionally. I can say this, although some of the code I saw in C is fuuuuugugly. Not only because it is procedural, but also because many of the coding standards are very accurate, but cannot be used. I don’t think it should be, it’s normal, it is usually written in a very unreadable style. It could also be due to my experience with object-oriented programming for so long.

0
source

Think about how C does everything in one giant static class in C #.

You pass data using pointers (you can do it in C #). That I find that most people's trips are signs.

You can create new types by creating structures (as you can in C #)

If you want to learn C, then pretend C ++ does not exist :)

0
source

All Articles