Jump to content

Is it difficult to learn C after learn C# ?

eric95204

Me and my friend have been learning C# for a few weeks now and we were interested in making a compatible driver for a game for the raspberry pi since its graphic drivers are open source. I looked into most linux driver tutorials and they use C. I was wondering if learning C after C# is to difficult and if its smart?

Link to comment
Share on other sites

Link to post
Share on other sites

I started out using C. It is really not that much harder. It might take a little to get use to the some differences like C has no booleans, no classes and less pre defined functions. The hardest part is going to be able to understand pointers and understand how to  make your own data structures. As far as being smart to learn, it's not a bad language to learn especially if you want to work with programs that require low level access like graphic design or kernel programming.

Link to comment
Share on other sites

Link to post
Share on other sites

C is what I first used.

 

Basically, C is like C# but a little more dumb, it does not have classes, you will be using more procedural style of code.

 

There are many libraries out there that you can use.

 

The hardest part will be learning pointers.

Link to comment
Share on other sites

Link to post
Share on other sites

C doesn't have objects, nor does it have actual booleans, it is a big learning curve to c#. Allocation of memory, dealing with buffer overflows, etc. It's for sure a more difficult language.

i want to die

Link to comment
Share on other sites

Link to post
Share on other sites

Yes and no I would say.

 

By knowing C# you have a good understandig of programming allready. C is more complicated and you can be a bit weirded out about how it behaves, maybe.

There are much to think about in C that you don't have to care about in C#.

 

So, it can be a steep learning curve, but worth it, it will give you a better understanding of programming and how everything works

Ryzen 7 5800X     Corsair H115i Platinum     ASUS ROG Crosshair VIII Hero (Wi-Fi)     G.Skill Trident Z 3600CL16 (@3800MHzCL16 and other tweaked timings)     

MSI RTX 3080 Gaming X Trio    Corsair HX850     WD Black SN850 1TB     Samsung 970 EVO Plus 1TB     Samsung 840 EVO 500GB     Acer XB271HU 27" 1440p 165hz G-Sync     ASUS ProArt PA278QV     LG C8 55"     Phanteks Enthoo Evolv X Glass     Logitech G915      Logitech MX Vertical      Steelseries Arctis 7 Wireless 2019      Windows 10 Pro x64

Link to comment
Share on other sites

Link to post
Share on other sites

C is procedural. And has that thing that is feared by many - pointers ^____^

Memory allocation is made "by hand" and there is no garbage collector.

But when you get a hang of it - it is not that hard.

 

PS Happy cleaning! :D

Link to comment
Share on other sites

Link to post
Share on other sites

I would suggest try to read some driver source code to see if you can understand them. It's very different from writing applications in C#. 

Link to comment
Share on other sites

Link to post
Share on other sites

The most difficult part is actually going to be to get into the right mindset. Everything in C# is object oriented, in C you don't get classes, inheritance or polymorphism. You will also have to get used to pointers and having to allocate and clean up memory yourself.

Link to comment
Share on other sites

Link to post
Share on other sites

I would suggest try to read some driver source code to see if you can understand them. It's very different from writing applications in C#. 

Woah-woah-woah. A driver? Don't you think that is way too harsh?

Link to comment
Share on other sites

Link to post
Share on other sites

I would suggest try to read some driver source code to see if you can understand them. It's very different from writing applications in C#. 

Like what @Darko_Nerivar is thinking....I don't think if he is just beginning to move to C he should be looking at source of any drivers lol. Maybe try converting some of his small C# apps to C would maybe be a start.

Link to comment
Share on other sites

Link to post
Share on other sites

Just wanted to point out (C what I did there?  ^_^) that strictly speaking you don't have the exact equivalent of classes, but there is something like "struct", which can make your code look a little more object oriented.

But yes, I have programmed in both C and C#, and even though the name is similar, the programming languages and concepts aren't. It would for example be easy to go from C# to Java or the other way around, but not to C. In any case, making a driver immediately would be way too difficult.

 

Wikipedia: struct

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×