Great C tutorial? [closed] - c

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 9 years ago.
I really want to learn C. What would be a good tutorial?

The C Programming Language (often referred to as "K & R") is almost universally considered to be the best resource for learning C.

While "The C Programming Language" is certainly a great book and a very good introduction to the C language, it has several drawbacks:
It is somewhat dated, the 2nd edition (the last one) covers only C89 which is now 20 years old. While C99 (the current Standard) isn't universally supported, there are a number of features from it that are supported by many implementations and exposure to them is useful.
It isn't comprehensive. It doesn't cover many of the standard library functions in any detail and certain intricacies are not explored in depth.
The text assumes you are already an experienced programmer and has a very terse style which doesn't work well for everyone.
If you are looking for a more beginner-friendly, comprehensive, or up-to-date book, I would strongly recommend C Programming: A Modern Approach, 2nd Ed. It covers every aspect of the language and the standard library in depth, including C99, and is extremely well-written. While the list price is rather high, it usually isn't difficult to find a copy for around $60 USD.

The Official GNOME Developer's Guide: http://oreilly.com/catalog/9781593270308/

Tutorials might be semi useful at first, but I always learned a language by actually developing useful code.
I'd recommend you check out some of the Gnome Love Projects.
They are generally smaller tasks for people who are interested in joining the gnome development community. They will help you get used to the dev environment, and submitting patches and the style & conventions they use. Most will teach you something you didn't know about C also.

The C book is a good and free ebook.

Here is one resource. http://www.physics.drexel.edu/courses/Comp_Phys/General/C_basics/

You may refer C Programming Notes meant to supplement K&R.

It's more a faq than a tutorial, but it is quite useful: C - faq.
Concerning Gnome programming: Gnome guidelines
And here are some tools every C programmer needs:
gcc
gdb - debugger
Valgrind
gprof - Profiler

Always avoid tutorials (written by kids, for kids)
Read KR

I would seriously advice you to check out Bruce Eckel's freely available "Thinking in C", which is a flash-based introduction to the C family of programming languages:
A Flash-based audio-visual seminar to introduce you to the fundamentals of the C language which will help you move on to C-based languages like C++, Java and C#.

Related

Looking for a good GUI library for C [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 9 years ago.
As the title says, I am looking for a good library for the C Programming Language.
The GUI library should be really popular. I'd also appreciate if there are popular forums on the Internet where I can ask professionals for help. And I definitively need a good book about the library. If it's possible it should be cross-platform but I can live without that... I guess ;)
The only library I know for C so far is GTK. It sounded really well to me but neither did I find any good book (I've actually seen only one book about GTK and I don't know if it's good or bad cause nobody posted a review) nor did I see anyone using it except 2 guys on You-tube with their impressing amount of 2 videos! >.< .
The really important thing for me is that it should be popular... I don't want to sit here, learn how to use this library and in a year or two nobody uses it any more.
I hope you guys can help me finding a library :)
GTK+ is hugely popular and is used extensively. It's the best choice if you want cross-platform GUI development in C alone. There are plenty of books around, though they're a bit outdated (but most of it still applies). You can find up to date tutorials and full API documentation at the GNOME project website.
GTK is the most popular GUI library in C you can find.
Have you tried amazon? There're plenty of books. It's hard to believe that all of them are bad.

How to start building a programming language in C? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I really would love to go through the experience of building a compiler, lexer, and so on using C, however I havn't found a single resource on creating one. I've read the book about creating your own language using Ruby, but it just talks about how C is the best option, and won't tell you where to go from there.
Is their any nice resources for building a language using C? I don't care how long it is, I just want to know how to build one.
One of the nice things about compilers/interpreters is that it doesn't really matter what language they are written in. In the final stage they will just be an executable on someone's machine.
That being said while writing my compiler (something I am currently doing) I have used several books that have been extremely helpful:
Compiler Construction by Niklaus Wirth
Compilers Principles, Techniques, and Tools by Jeffrey Ullman, Alfred Aho, Ravi Sethi
The Wirth book will walk you through all the stages of creating a compiler for a language called Oberon-0. It also has the entire source code for his finished compiler, so you can play around with it on your own machine. The compiler itself was written in Pascal (something else that Wirth created).
The Dragon Book has really good information and examples in C! This may be what you are looking for, but as I said above, the language you write the compiler in isn't all that important.

Are there any alternatives to C? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 12 years ago.
C++ is often touted as the evolution of C, which it is not. To draw an analogy for the kind of language I'm looking for:
Perl, Python, Ruby, Groovy
C++, D
Java, C#
C, Fortran, Modula-2?, Pascal?, Go?, Rust?
Do any proposed, or implemented languages fit in the same (enormous) niche as C, with the intention of being an alternative, while maintaining all the applicability to OS, high performance, embedded and other roles?
I think the problem with this question and subsequent discussion is that very rarely are languages intended to replace others. Sure, as you attempted to clarify and defend some of your groupings, they share similar feature sets or accomplish similar things, but ultimately, I don't think anybody is going to sit down and write a language that is designed to replace another. What is far more likely is that language designers want to accomplish a goal and will pick and choose aspects of certain languages that already do that. For instance, take a look at Go which is designed to up the ante a bit with regards to ultra-high performance systems programming which, arguably, competes with C a bit. However, if you look at the FAQ on the mission of the project, they aren't seeking to replace C, but simply augment it and address issues it faces (such as dependency management to name one) (so perhaps this is the answer you're looking for).
So really, whether something is an evolution of something else, depends entirely on the perspective from which you examine and evaluate the evolution. C++ can be considered an evolution of C because it introduced a new feature set (OO programming) that many consider a step forward in systems design while still retaining a similar syntax and compatibility with C code. However, it is not entirely an evolution because it is also missing some features that make C a language currently used today. No one language can do everything (except for maybe Lisp ;-) I kid, I kid) and never will. No one language is without tradeoffs. The abstractions that make web development easy are the same abstractions that make low-level systems development impossible (or prohibitively difficult). So I really think it's hard to say X is an evolution of Y. Rather, I would say "I want to do W and I know I can use language X but is there something that accomplishes my goals of A, B, and C better?" Unfortunately programming languages aren't black and white enough to make sweeping statements like that and like every decision you make in programming, it's about trade-offs.
The following picture will say more than I could write:
Maybe Google's Go language will be. At least, that's what I'd expect Google's Go team hopes it will become.
Pascal would be an equivalent, so would Modula-2.
Mozilla also has a new language called Rust, this is a really nice modern language that is targeted at the same kinds of applications as C/C++
https://www.rust-lang.org/
C has more than one niche, really. For low-level systems programming, C replaced platform-specific assembly languages, and nothing has really challenged C in that domain. C++ would be the only other possible candidate, there (BeOS, many device drivers, etc.).
C was/is also used a lot for high performance numerical code. In that domain, FORTRAN still has the edge, and there are many other challengers (C++, Matlab, Numpy, Fortress, Scala).
At some level, C is the lowest common denominator that has cross-platform portability.

What does good, modern c code look like? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 9 years ago.
I'm primarily a c#/.NET programmer, but the hobby project that I am about to take on will involve coding in c.
I know that there is a ton of c code out there, but its very hard to separate a well structured c project from a badly structured project if you did not "grow up" with the language. Can anyone point me toward a newer, non trivial (but not enormous) project that is considered a good example of how to structure c code?
Edit
If you cannot find a project, feel free to discuss in words how you think a c project should be structured.
Dave Hanson's C Interfaces and Implementations is a very well-crafted library of about 7000 lines of code. The book is great if you can afford it.
The implementation of the Lua programming language and libraries is about 17,000 lines of C code and is very well done but quite sophisticated in places—compilers and garbage collectors are not so easy to understand without background in those fields. But the code is beautifully engineered.
Git is over 125,000 lines of code. I can't recommend that anyone study it as an example of how to engineer C code. Just the design and public interfaces, let alone the implementations, are hard to understand—which is why there are so many git tutorials.
Check out git source code: http://github.com/git/git/tree/master
I consider Steve Dekorte's IO language implementation to be a good example for clean and pragmatic modern-day C.
This is completely anecdotal, but I've heard that the SQLite project is considered good code.
How about:
"The C Programming Language", 2nd edition, Kernighan and Ritchie
Answers to Exercises
http://users.powernet.co.uk/eton/kandr2/
The following book (with code examples) could ease your paradigm shift a bit:
Stephen Kochan
Programming in C, Third Edition
http://www.kochan-wood.com
The SVN project is written entirely in C and it is well maintained: consistently styled, good comments, low code smell. I recommend perusing it.
C: A Reference Manual contains a variety of example code usage, with implementations centric to Standard C; A definite document to look into, perhaps along with the C Std.

Interview questions to assess Linux C programmers [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 11 years ago.
I'm not quite a C programmer and I'm going to interview a guy with 3 years experience in C in linux. In his CV, he says he is quite experienced with C programming.
So my question is if you are going to interview this "C linux" guy, what question or questions would you ask to make sure that this guy is competent? By the way,
I expect you give me the answer as well :-).
Thanks in advance.
If the candidate really knows his stuff (C Linux programming) he'll catch you pretty quickly, but anyway, here are a few pointers to topics you should investigate to prepare questions:
POSIX concepts
Standard C library (libc), ANSI C
Debugging and profiling tools: gdb,
valgrind, strace, etc
Linux/UNIX system calls: sbrk,mmap,fork,etc
Threading
(Insert your favorite pointer question here)
The GNU toolchain: gcc,ld,as,automake,autoconf, etc.
Classic Linux utility C/C++
libraries: glib,qt, etc.
Don't simulate knowledge you don't have. This will get noticed and this is the image of your company that you are playing with. Candidates may want to find better oportunities.
Be honest with your level of C and ask him open questions about what he finds wonderful in C and Linux, and what he thinks are drawbacks. Let him tell you what were his previous experiences.
Appreciate not his knowledge but his passion.
To be honest I think your best bet is to get someone who is a C programmer in the interview with you to ask questions, you can only really judge competences you have yourself.
If that isn't possible I'd say you should be askind questions that test their knowledge of pointers. an obvious example is to write string manipualtion functions such as strcpy
Favorite:
Ask him where the strenghts of C are...and why he would recommend to use it...maybe you can give him a project example. He has to clarify why C is the right Language for that Job from his point of view.
From my point of view it is very important to know if a Language is really fitting to a project. Not because its your favorite Language...
It is an easy question...
If all you are trying to do is assess his knowledge of a specific language, and you don't know that language, you're gonna fail at evaluating him.
Can you instead evaluate "can this guy program and is he a good communicator" and be up-front with him about your knowledge? Give him a basic question to start with, fizzbuzz or whatever, and ask him to code it in C and give you a C tutorial as he does it. Then do something more complex but C-ey (see other answers for ideas) but still in the context of, "teach me what you know and how this works".
If you frame the question as, "I know (for instance) python and Java, but not C, please teach me" you could end up with a very informative interview. But don't give the poor guy a quiz, you won't be able to give him hints, and he could ace it or flub it with very little correlation with his actual skills.

Resources