Header Ads

Niagahoster

Head First C

Want to get inside the computers head?

Need to write high-performance code for a new game? Program an Arduino? Or use that advanced third-party library in your iPhone app? If so, then C’s there to help. C works at a much lower level that most other languages, so understanding C gives you a much better idea of what’s really going on. C can even help you better understand other languages as well. So dive in, grab your compiler, and get started in no time.

C Programming Language

C is a language for small, fast programs

The C language is designed to create small, fast programs. It's lower-level than most other languages; that means it creates code that's a lot closer to what machines really understand.

The way C works

Computers really only understand one language - machine code, a binary stream of 1s and 0'. You convert your C code into machine code with the aid of a compiler.

The way C works

C is used where speed and space are important. Most operating systems are written in C. Most other computer languages are also written in C. And most games software is written in C.

The C language doesn't support strings out of the box

C is a lower-level than most other languages and so instead of strings, C normally uses something similar: an array of single characters. If you've programmed in other languages you've probably met an array before. An array is just a list of things given a single name. So card_name is just a variable name we use to refer to the list of characters entered at the command prompt. We defined card_name to be a 2 character array so we can refer to the first and second character as char_name[0] and char_name[1]. To see how this works, let's take a deeper dive into the memory of the computer's memory and see how C handles text.

David Griffiths and Dawn Griffiths


Powered by Blogger.