C Programming is still a very valuable skill - and its also surprisingly easy to pick up. Don't be intimidated by C's reputation as scary - we think this course makes it easy as pie!
Using discussion forums
Please use the discussion forums on this course to engage with other students and to help each other out. Unfortunately, much as we would like to, it is not possible for us at Loonycorn to respond to individual questions from students:-(
We're super small and self-funded with only 2 people developing technical video content. Our mission is to make high-quality courses available at super low prices.
The only way to keep our prices this low is to *NOT offer additional technical support over email or in-person*. The truth is, direct support is hugely expensive and just does not scale.
We understand that this is not ideal and that a lot of students might benefit from this additional support. Hiring resources for additional support would make our offering much more expensive, thus defeating our original purpose.
It is a hard trade-off.
Thank you for your patience and understanding!
The C programming language is still relevant, especially for three kinds of folks. One, embedded systems or hardware folks moving to software. Two, folks looking to learn C++, and needing first an introduction to the details of C. Three, folks who have are taking a C course in college, and have no choice but to learn the language:-)
Let's start with a very high-level view of what a C program looks like. The compiler, preprocessor, main function as the entry point, and headers. All of these are little bits you've got to understand before you can write your first C program. But fear not! Nothing too complicated here!
A quick introduction to the important data types in C - and to two important ideas: that of overflow (what happens if the data in a short int exceeds 32,767?) and that of characters as numeric types in disguise (you can add chars like you would ints)
If/Else statements are decision control structures - they transfer control to different points in code depending on a condition. Let's understand their syntax and intricacies.
The condition is at the heart of an if/else statement, and there is a lot going on here: relational operators, logical operators, the order of evaluation, and short-circuiting.
We wrap our section on if/else statements by dwelling a bit on the else portion of the if/else loop.
The switch-case-default control structure, aka the case statement, is a strange bird. Its bristling with strange rules, which is perhaps why its not used very often.
We continue talking about the eccentricities of the switch statement - and you can bet there are a lot of them!
We wrap up with the case structure - it is bristling with strange rules, which is perhaps why its not used very often.
Once you're used to the idea of an if/else statement, a while loop is not much of a stretch. We parse its structure in detail.
We keep going on while-loops - conditions and gotchas, and the break and continue statements make their first appearance.
For loops are incredible - they are probably the most important and popular construct in all programming languages. Let's see how they work.
The ++ and -- operators were introduced by C, and have become ubiquitous in programming. They can be confusing, so let's make sure we understand them - and also that we understand unary/binary/ternary operators, and their precedence rules.
Functions are an incredibly powerful idea - let's understand why (hint: Dilbert has the answer). Also - return value and argument list - terms that will become part of our everyday lexicon if we do enough programming.
Declaring, defining and calling a function: understand exactly what these terms mean.
Pass-by-value and pass-by-reference: Understand exactly what these terms mean.
The characteristics of a variable - where it resides, what default value it has (prior to initialisation), its visibility and the lifetime of its existence - are governed by something called the Storage class of a variable. Let's understand the 4 storage classes: automatic, register, static and external.
We start with a quick tour of how code compilation works - what the steps are to go from source code to an executable file. Once we understand that, we can easily make sense of the preprocessor, and of the common preprocessor directives such as #define and #include
Making sure we understand the 4 major types of pre-processor directives: macros, file inclusions, conditional compilation directives, and miscellany. Macros and functions each have their place in C
Console IO - reading from or writing to screen - is one of the bits about C programming that folks really find complicated - but don't fear! We'll break it into byte-sized chunks. Starting with printf.
We keep going with printf - there's a lot where this came from :-)
We dig deep into scanf, which reads input from screen.
We wrap up this section on Console IO by discussing the miscellaneous IO functions: sprintf, fprintf and sscanf.
File IO in C - and indeed File IO in pretty much all languages - is based on 2 key concepts: buffers and streams. A buffer is a temporary storage area (in memory) for data that's in a file (on disk). A stream is data-in-motion - a conveyor belt moving data from one place (buffer or device) to another. Once you understand this, all File IO will make a lot more sense.
The things that you do with files - open them, close them, read them, write to them - are hardly rocket science. And once you recall what streams and buffers are, its even less arcane. Just look past the syntax (which is pretty arcane)
Now that we are done with really understanding how fopen works, the other operations will stream by (bad joke alert!)
If you can open a file in a text editor and make sense of what it says - then its a text file. Else its a binary file. Just remember that, and you'll be just fine:-)
We dig into the bitwise AND, OR and NOT operations - visually inspecting how they work.
We continue with bit manipulation - the right shift and left shift operators are very powerful, but they have 2 issues that you should be sure to understand: overflow, and fill.
Before diving headlong into bit manipulation problems it's helpful to learn a few useful tricks which help you build a strong foundation to visualize working with bits.
Functions to get the nth bit of an integer and to set the nth bit of an integer. These are the building block functions and the concepts underlying these will be used for harder bit manipulation problems.
Print all the bits used to represent an integer from the most significant bit to the least significant. Learn some subtle details about the shift right (>>) with negative numbers!
Count the number of 1s in an integer, and learn a neat trick which allows you to do it in complexity O(number of 1s).
Reverse the bits in an integer. This pulls together a whole bunch of stuff from the last few problems. As in the case of hard problems, visualizing the process is key to solving this!
C Structs are the first user-defined types that we will encounter - the precursor to objects/classes and all of Object Oriented Programming
A space-saving trick - C unions have largely passed into history. Just remember that they are just like structs, but for one key difference.
We will introduce the idea of dynamically allocating memory, i.e. creating space in memory for data on-the-fly. This contrasts with the typical way in which memory is allocated in C programs.
If memory is allocated dynamically, it is super-super important that you also free that memory. Else, your program will leak memory. For any programmer of a certain age, the term 'memory leak' is enough to induce nightmares. So be absolutely sure to free dnyamically allocated memory.
There is a fundamental difference between dynamically and statically allocated memory: dynamically allocated memory lives on the heap, while regular statically allocated memory lives on the stack. Don't worry if that did not make a lot of sense - it will after you watch the lecture:-)
The C programming language has some other handy ways of allocating memory - let's make sure to understand these.
Understand what an array in C is: its a contiguous block of memory that holds individual elements, each of the same size and layout.
Its a bit of a black art to pass arrays to functions as arguments - but don't be intimidated! Its easy once you think about it right.
We described arrays as contiguous blocks of memory, holding individual elements that are each of the same size and layout. Well, that's exactly what a string is - an array of characters:-)
Loonycorn is us, Janani Ravi and Vitthal Srinivasan. Between us, we have studied at Stanford, been admitted to IIM Ahmedabad and have spent years working in tech, in the Bay Area, New York, Singapore and Bangalore.
Janani: 7 years at Google (New York, Singapore); Studied at Stanford; also worked at Flipkart and Microsoft
Vitthal: Also Google (Singapore) and studied at Stanford; Flipkart, Credit Suisse and INSEAD too
We think we might have hit upon a neat way of teaching complicated tech courses in a funny, practical, engaging way, which is why we are so excited to be here on Udemy!
We hope you will try our offerings, and think you'll like them :-)