Tagged: C

0

Programming in C: Program Operators and Order of Operations

This article is a continuation on expressions that can be constructed in the C language.  This article will focus on expressions involving operators.  If you remember, expressions are pieces of code that are executed right away to yield some kind of result, as opposed to a statement which may affect an entire program’s structure.

0

Programming In C: Bitwise Operators

By incorporating bitwise operations in its core language, C provides a way to program low level processor specific operations inside a more structured program (as compared to assembly).  C lets us perform ands, ors, exclusive ors, and one’s complement operations to chars and ints.

1

Programming In C: Relational and Logical Operators

Being able to compare the values of variables is extremely important in any C program.  Later on we’ll cover how we can alter the flow of a program depending on the results of relational and logical operators, in essence creating programs or processes that can somewhat “think” for themselves.  C provides an AND, OR, and NOT operators, but from these operators we can easily build any kind of more complex boolean logic operation, as we have done above with exclusive or (XOR).

1

Programming In C: Arithmetic Operators

C includes the basic arithmetic operators, including assignment, division, multiplication, addition, subtraction and modulus.  When you operate on variables and other literals you have to be careful of your type conversions that C automatically does for you, lest you lose some of the data you are trying to protect.

0

Programming in C: Typedef

What if ther was a way to name a certain type, and then use that name across your program?  That way, if that particular type needed to be changed, say to be an int instead of a char, you could specify that in one place.  Well, that’s where the typedef  statement comes in. However, typedef’s can be a mixed bag, if used too much you acquire obfuscation in your code, but if used to little, you may end up having to edit your code in multiple places; or you may end up with code whose purpose is difficult to understand.

1

Programming in C: Structures

Structures are ways to encapsulate related data, presumably, under one data type.  This allows us to organize data that is related to each other into one place.  Otherwise, all of our data would have to exist in separate variables, and as we programmed we’d have to remember how it call connected ourselves.  This is truly prone to drastic error, and memory wise is convoluted.

0

Programming In C: Literals

Literals are very important in programming, as they are one way to get data into a program.  Assigning literals to variables allows us to specify a number of things such as the number of times we’re going to perform an operation.  Using literals in various parts of the program allow us to specify how large an array is going to be.  Using string literals we might hard-code (that’s when you put data that the program uses straight into the program code) an array of error messages that would be output when certain errors happen.

1

Programming In C: Arrays With Pointers

Pointers and arrays are closely related in C.  Using indexes and pointers to access the contents of an array are simply two sides to the same coin.  They offer two perspectives that aim towards the same goal.  With pointer arithmetic (which we covered in the article on pointers), you can access each element in the array one after another or randomly.  With array indexing you can specify a short hand number that is easier to understand and read but does the same thing.

1

Programming in C: Pointers

Pointers at this point in the article series may seem like more of a pain that a boon, but they are very powerful when it comes to constructing articulate programs. Pointers allow us to pass the memory addresses of specific objects around in our programs, and to modify memory in various places.

0

Programming in C: Arrays and Strings

Arrays give us a wealth of opportunities to creatively solve our problems, and I hope I was able to elaborate on more of their functioning in this article.  They can be confusing at first, particularly multi-dimensional arrays, but they are simply sequences (of seqences of sequences…).  Thanks for reading

0

Programming In C: Basic Data Types

In C variables have to be of a specific data type. Luckily, C defines only 5 basic data types that it works with, so it’s not too difficult to choose what you want. All the data types are covered in this article, including their size modifiers unsigned, signed, short and long.

0

What is an Integrated Development Environment (IDE)?

I’m not personally huge on modifying or getting my IDE to do lots of bells and whistles, but simply having a central program and place to debug, test, compile, and write your code is very powerful for your productivity.  Add on that basic code inspection tools, error checking, syntax highlighting, file tracking, version control, and you got yourself a tool I’d use any day.

0

What Is A Linker?

Linkers are essential pieces of the software development process and allow programmers to separate out their code in meaninful ways.  They also allow the use of programming libraries, code that has been generated to be used by other programs.  The C Standard Library is an example of such a library, allowing standard C programs to link to its code to perform such operations as general input/output.  If we did not have a linker in our compilation process we’d have to write all our programs as one giant monolithic file.

0

Memory Map of an Imperative Program on Most Processors

This isn’t THEE only memory map of every program everywhere, but it is generally the memory map for most programs most average programmers create, being imperative.  In programming languages like assembly or C, you work with this map pretty directly, but in more abstract or higher-level languages such as Python or PHP, many of these memory issues and placements are taken care of for you by the interpreter or compiler.

0

Interpretation Versus Compilation

You will find some individuals who consider whether a language is usually interpreted or compiled split languages into these categories.  However, the truth of the matter is quite the opposite.  Whether a language is compiled or interpreted is actually an independent choice from the nature of the language itself.  Any language can be interpreted by what is known as an interpreter, or compiled by what is known as a compiler.

0

The Nature of the C Programming Language

In this article we cover the C programming language: where did it come from, how it relates to other languages, what can it do, what doesn’t it do, and the future of the language. C is a powerful language any aspiring programmer would benefit from learning and mastering. Even today, in embedded systems, C is very much employed, and in that personal respect, important to building my robot.