Minimum price
Suggested price


About the Book

Why write a new book on programming using C language?  My experience, based on teaching the use of this language to learn to program, for more than 15 years to students who are just starting out in programming, has led me to make this decision due to several factors:

1.The C language, being a compact language with a limited number of features, presents difficulties to students because of its extensive use of pointers (object addresses) and proximity to the hardware. In the teaching of this language, it was standard to incorporate the use of pointers after half of the subject. As a result of this methodology, students at the end of the course did not fully understand the use of pointers and their diagnosis was that the C language is difficult to learn. About 5 years ago, I modified this methodology and began to teach C language incorporating pointers from the first class. To make this possible, I use analogies that allow students to associate pointers (addresses) with objects, which for them is of immediate understanding.

2. My years of experience teaching this language have allowed me to locate the points where students have difficulty understanding. To correct this, in the book I make extensive use of diagrams that allow better visualization of the difficulties and therefore, notably improve their understanding.

3.In the book, I deliver many solved problems, which emphasize the topics that present greater difficulties, such as creation of complex types, functions, the use of function pointers, dynamic arrangements, etc.


The result of these five years, using this new methodology, has been satisfactory and in my opinion, has generated a change in the students' predisposition towards learning the C language. I have been able to verify, that already in the last third of a course, the students handle with naturality the use of pointers. I consider that most engineer, must know reasonably well how to program using C language and I hope that this new book contributes to that direction. allows me to publish this book in its first five chapters and first edition, which I appreciate and certainly motivates me to finish the next chapters and keep, as far as possible, this book updated.



  • Share this book

  • Categories

    • Computers and Programming
    • C and C++
    • Textbooks
    • Computer Science
    • Engineering
    • Software
  • Feedback

    Email the Author(s)

This book is a translation into English of Programando con Lenguaje C which was originally written in English.

About the Author

Ricardo Sánchez Schulz
Ricardo Sánchez Schulz

Ricardo W. Sánchez Schulz is currently a professor in the Department of Electrical Engineering at the University of Concepción in CHILE.

He obtained his PhD degree from Ohio State University, U.S.A. and later completed a postdoctoral program at Imperial College in London.

His field of work is related to digital systems, visualization, and computer graphics.

Within a vast trajectory in the development of computer products, is the construction of a computer simulator for the training of officers of the Submarine Force of the Chilean Navy. He also worked in the development of a three-dimensional graphic simulator, based on haptic elements, for knee surgery.

In another project, he used haptic elements for the teaching of mathematics and science for elementary and middle schools.

He currently teaches programming, computer graphics and computer architecture in the Electrical Engineering department of the University of Concepción.

In his free time, he enjoys reading and painting.

Any questions with the author, send an email to

Table of Contents




1.0 Origin and versions of the C language

1.1 Characteristics of the C language

1.2 Essential elements of the C language

1.2.1 Types 

1.2.2 Objects 

1.2.3 Variables 

1.2.5 Addresses 

1.3 General scheme of a C language program 

1.4 Compilation 




2.1 Numbers 

2.2 Data 

2.3 Types 

2.3.1 Basic types 

2.3.2 Floating or decimal types 

2.3.3 Character type

2.4 Variables 

2.4.1 C patterns 

2.5 Operatos

2.6 Standard library function printf() 

2.7 Memory 

2.8 Pointers types 

2.9 Assignment sign actions 

2.10 Identifiers 

2.11 Keywords in C language 

2.12 Operators in C 

2.12.1 Arithmetic operators 

2.12.2 Relational operators 

2.12.3 Logical operators 

2.12.4 Bit-level operators 

2.12.5 Assignment operators 

2.12.6 Precedence of operators in C language Operators' Associativity 

2.12.7 Conversions and cast 

2.13 Pointers Arithmetic 

2.14 Properties of pointers 

2.15 NULL pointer 

2.16 Pointer to pointer 

2.17 Pointer to void 

2.18 Use of const 





3.1 Arrays                                                                                                                                                 

3.2 Declaration of arrays                                                                                                                                     

3.2.1 Initialization of an array                                                                                                                             

3.2.2 Designated initialization of an array                                                                                                         

3.3 Two and three dimensional arrays                                                                                                               

3.3.1 Two-dimensional arrays                                                                                                                             

3.3.2 Three-dimensional arrays                                                                                                                          

3.4 Pointers on arrays                                                                                                                                          

3.5 Size of an array                                                                                                                                               

3.6 Statement of arrays with empty parentheses                                                                                              

3.7 Character arrays                                                                                                                                             

3.7.1 Arrays of pointers to characters                                                                                                                

3.7.2 Variable dimension arrays                                                                                                                         

3.8 Dynamic memory allocation                                                                                                                         

3.8.1 malloc()                                                                                                                                                        

3.8.2 realloc()                                                                                                                                                        

3.8.3 calloc()                                                                                                                                                         

3.8.4 Declaration and initialization of a pointer with malloc()                                                                                

3.8.5 Release of the memory reserved by malloc()                                                                                              

3.8.6 Dynamic creation of two or more dimensional arrays




                      STATICS VARIABLES and scanf


4.1 Expressions                                                                                                                                                     

4.1.1 Expressions with relational operators                                                                                                      

4.1.2 Expressions with logical operators67

4.1.3 Expressions with increment and decrement operators 

4.1.4 Expressions with arithmetic operators 

4.2  Loops 

4.2.1 The for statement Nested for loops 

4.2.2 The while statement 

4.2.3 The do-while statement

4.3 Selection statements 

4.3.1 The if and if-else statements

4.3.2 The switch statement

4.4 Static variables 

4.4.1 Blocks in C language 

4.4.2 Declaration of static variables 

4.4.3 Differences between static and local variables 

4.5 scanf function

4.6 Resolved exercises 

4.6.1 up to 4.6.10






5.1 Functions 

5.2 Passing arguments by value 

5.3 Passing arguments by reference 

5.4 Passing an array as an argument to a function 

5.5 Return of a function 

5.6 Using exit() in a function 

5.7 Static variables in a function

5.8 typedef 

5.9 Pointers to function 

5.10 Stack 

5.11 Recursion 

5.12 CallBack Functions 

5.13 Function returning another function 

5.14 inline Functions 

5.15 Resolved exercises 

5.15.1 up to 5.15.10






Chapter 10: to be defined

The Leanpub 60 Day 100% Happiness Guarantee

Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

Now, this is technically risky for us, since you'll have the book or course files either way. But we're so confident in our products and services, and in our authors and readers, that we're happy to offer a full money back guarantee for everything we sell.

You can only find out how good something is by trying it, and because of our 100% money back guarantee there's literally no risk to do so!

So, there's no reason not to click the Add to Cart button, is there?

See full terms...

80% Royalties. Earn $16 on a $20 book.

We pay 80% royalties. That's not a typo: you earn $16 on a $20 sale. If we sell 5000 non-refunded copies of your book or course for $20, you'll earn $80,000.

(Yes, some authors have already earned much more than that on Leanpub.)

In fact, authors have earnedover $13 millionwriting, publishing and selling on Leanpub.

Learn more about writing on Leanpub

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub