Is C similar to C# (C-sharp); or are they completely different ? I was wondering if I should begin learning C# and the transition to C will be a tad bit easier ?

Recommended Answers

All 10 Replies

There are similarities between C and C#. You can still write pointer code in C# if you would like to do so. Instead of printf you would use Console.Write in C#. If I were you, begin learning C#.

I think you'll find that C# is more akin to C++ than C. I also think that C# will take you in different directions than C, since it is Object Oriented and is fully integrated with the .net librairies, including creating windowed GUI's, web-based, and data based applications. Due to it's very basic code, C, I believe, is favored by many of those that do embedded programming.

I'm completely torn between learning C or C#. I've been informed to learn C to which I can simply migrate to C++ fairly easy if I want.

Here's my view.

If you are going to write for embedded microprocessors (think tiny!) then C.
If not, just bite the bullet and start with C++.

Now if you are writing Windows Apps I think C# is great. I used that for some of my best apps. They went out to the field and were the least trouble of all our apps.

Doesn't C help with understanding how computers and programming work to the core ? You can't write programs with C ? I won't be writting anytime soon Windows Apps or any App in general.

I assume I can use C to write to Raspberry Pi; as well ?

@S, I'm going to write no. Many years ago before we had C almost everywhere I wrote in assembler. That demanded we know the processor and system to the core. When we moved to C we didn't have to know as much since it's there to remove the requirement to be intimate with the host details or even what CPU was being used.

As to the assumptions, a google search could confirm that.

You can write programs with C. You can even write Windows, Mac, or Linux GUI programs with C. The main disadvantage is that you have to use the native API's for each type of machine, which can create major problems when the OS decides to change the API's you rely on. Another aspect to consider, since C doesn't lend itself to an Object Oriented approach, it's very easy to get into bad programming habits.

If embedded programming is to be your focus, then C is a very good place to start. There are also several good online tutorials that teach using C in embedded programming.

@tinstaafl, this is a really good area where your choice of C or such can matter. That is, picking C for embedded work is one of your best choices since there's a chance others may understand what you did and be able to maintain or fix it later.

We all have stories. One job had a crushing requirement on cost so the cheapest microcontroller was going to be used and it had no RAM. Just registers and a few hundred bytes of flash memory. The task at hand was to add functionality to an existing system that was omitted and the product was already being sold at or below cost. A salvage job. This meant assembler was the choice and it was done but few dared to review that one. Once done the product finally was sold off and the company moved on much the wiser.

Thanks, what I may do is do some basic understanding of C all the while begin to learn C++; as to understand their differences and structured programming.

No, you are wrong. C is not C#. C# is built on a common language runtime with a just in time compiler. C# is c-esque, but not C. C# is more akin to a refined language such as Java. In fact Java has recently tried to emulate some of C# functionality LINQ -> Streams api. The common language runtime is available to several languages including VB.NET, etc. In order for C/C++ too create managed code they have to implement the trappings of very complex management code in order to interoperate. C++/C has pointers. C# has object references. In fact when a student learns C# the usage of pointers is underemphasized, whereas in C/C++ it is overemphasized. Furthermore C# implements MSTLE which is a bytecode scheme which is similar to Java bytecodes. The MSTLE is compiled (at runtime by the jit compiler) into a custom tailored machine code for whichever operating system it is in fact running on. C# is something much more approachable than C/C++. In fact you should add back onto the DANNI WEB site the missing software column C#. C# is a very High level language, even more high level than C++.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.