Discover millions of ebooks, audiobooks, and so much more with a free trial

Only $11.99/month after trial. Cancel anytime.

C language Programming: Simple, Short, and Straightforward Way of Learning C Programming
C language Programming: Simple, Short, and Straightforward Way of Learning C Programming
C language Programming: Simple, Short, and Straightforward Way of Learning C Programming
Ebook260 pages2 hours

C language Programming: Simple, Short, and Straightforward Way of Learning C Programming

Rating: 3.5 out of 5 stars

3.5/5

()

Read preview

About this ebook

This book is for absolute beginners with or without prior knowledge in programming, as this book uses Simple words, Short sentences, and Straightforward paragraphs. The triple S way of learning C language programming. The topics covered in this book includes brief introduction to C language, variables, data types, control structures, functions, pointers, and input and output stream to external files. This book starts its discussion from short history to installation of the needed software resource and a step by step screen shots of how to write C language code, compile and execute C programs. It presents graphical representation of algorithms for simpler learning. This book is packed with working and running C program samples and after reading this book, the reader would be able to develop and create C language programs based particularly from problems given in computer science courses, hence, adopting to other programming language will be a lot easier. This book is your first step in your programming career.

LanguageEnglish
Release dateSep 23, 2016
ISBN9781370069040
C language Programming: Simple, Short, and Straightforward Way of Learning C Programming
Author

Sherwyn Allibang

Sherwyn Allibang has 10 years experience in the academe as college professor handling business and IT related subjects. Aside from his career as an academe, he is also a freelance software developer catering system development from project management to core programming. With the degree in Bachelor of Science in Information Technology, Master in Business Administration, Master in Information Technology, and Doctor in Business Administration, Sherwyn is a solutions-focused, team oriented IT Specialist, with broad-based experience and hands-on skill in the successful implementation of highly effective technical support strategies. A proven ability to successfully analyze an organization's critical support requirements, identifies deficiencies and potential opportunities, and develops innovative solutions for increasing reliability and improving productivity.

Read more from Sherwyn Allibang

Related to C language Programming

Related ebooks

Programming For You

View More

Related articles

Reviews for C language Programming

Rating: 3.3333333333333335 out of 5 stars
3.5/5

3 ratings2 reviews

What did you think?

Tap to rate

Review must be at least 10 words

  • Rating: 4 out of 5 stars
    4/5
    Good overview of C language, Pointers and arrays could've been elaborated bit more.
  • Rating: 5 out of 5 stars
    5/5
    great read; helped indicate format coding
    great for reference as well

Book preview

C language Programming - Sherwyn Allibang

C language Programming: Simple, Short, and Straightforward Way of Learning C Programming

Copyright 2016

Sherwyn Allibang

Edition License Notes

This book is authorized for your own personal use. This book may not be re-sold or offered away to other individuals. Much thanks to you for regarding the diligent work of the author.

Introduction

This book is for absolute beginners with or without prior knowledge in programming, as this book uses Simple words, Short sentences, and Straightforward paragraphs. The triple S way of learning C language programming. The topics covered in this book includes brief introduction to C language, variables, data types, control structures, functions, pointers, and input and output stream to external files. This book starts its discussion from short history to installation of the needed software resource and a step by step screen shots of how to write C language code, compile and execute C programs. It presents graphical representation of algorithms for simpler learning. This book is packed with working and running C program samples and after reading this book, the reader would be able to develop and create C language programs based particularly from problems given in computer science courses, hence, adopting to other programming language will be a lot easier. This book is your first step in your programming career.

TO GOD BE ALL THE GLORY!

The resources used in this book are:

> Personal Computer running Windows 7 Operating System

> Dev-C++ available at http://bloodshed.net

Other Windows OS versions can also be used as long as it supports the above mentioned software. You may also ought to use other C compilers or IDE. Moreover, the sample programs and codes also work with Linux Operating Systems.

NOTE: All links provided in this book are updated occasionally. If a link becomes unavailable, email me at zherwyndbest@facebook.com

Table of Contents

Acknowledgement

Dedication

Chapter 1 - Starting C Language Programming

Short history of C Language

Reasons to use C Language

Beginning to Program in C Language

Installing the Dev-C++

Installing compiler for Linux

Self-assessment questions

Chapter 2 - Our First C Language Program

Definition of programming terms

The components of a C program

Writing, compiling, and running our first program using Dev-C++ for Windows

Correcting errors

Writing, compiling, and running our first program with Linux

Statements

Null Statements

White spaces

Self-assessment questions

Chapter 3 - Storing Data: Variables and Data Types in C Language

Variable

Variable Declaration and definition

Scope of variables

Constants

Keywords

Conversion specifiers of data types

Self-assessment questions

Chapter 4 - Fundamentals of Input And Output in C Language

Displaying text on-screen

puts() function

printf() function

Literal text

An escape sequence

Accepting user input

getch() function

getche() and getchar() functions

scanf() function

gets() function

Self-assessment questions

Chapter 5 - Arrays and Strings in C Language

What is an Array?

Single-Dimensional

Multi-Dimensional Array

Strings

Declaring and defining a string

Defining a string using input functions

Strings' pre-defined functions

Length of a String

Concatenation of Strings

Compare Two Strings

Copy Strings

Reversing the Order of a String

Converting Uppercase Strings to Lowercase Strings

Converting Lowercase Strings to Uppercase Strings

Self-assessment questions

Chapter 6 - Mathematical Operations in C Language

Expressions

Operators

Assignment Operator

Mathematical Operators

Binary

Unary

Mathematical operators precedence level and parentheses

Relational Operators

Logical Operators

Type Casting

Pre-defined Mathematical Functions

acos()

asin()

atan()

atan2()

cos()

cosh()

sin()

sinh()

tan()

tanh()

exp()

log()

log10()

pow()

sqrt()

ceil()

fabs()

floor()

fmod()

Self-assessment questions

Chapter 7 - Conditional Statements in C language

The if() statement

Single-alternative

Dual-alternative

Multiple-alternative

Nested if() statement

The switch() statement

Things to consider in conditional statement

Self-assessment questions

Chapter 8 - Looping Statements in C Language

What is a Loop?

Counter-controlled loop

for() loop statement

Nested for() loop statement

Condition-controlled loop

Pre-test loop

Post-test loop

The Infinite Loop

Self-assessment questions

Chapter 9 - User-Defined Functions in C Language

User-defined function

User-defined function prototype

User-defined function definition

Calling a user-defined function

Things to consider in functions:

Self-assessment questions

Chapter 10 - User-Defined Data Types in C Language

Structures

Declaring a structure

Defining a structure

Accessing Structure Members

Compound declaration and definition of structure

Self-assessment questions

Chapter 11 - Pointer in C Language

Pointers in C language

Pointer Declaration and definition

How pointers works?

Pointer Arithmetic

Self-assessment questions

Chapter 12 - File Management in C Language

File management in C

Defining and opening a file

Closing a File

Reading and writing a file

putc() and getc() functions

fprintf() and fscanf() functions

Deleting a File

Renaming a File

Self-assessment questions

Answers to self-assessment questions

Ending Notes

Disclaimer

About the Author

Acknowledgements

The author wishes to express his heartfelt gratitude to the Almighty God for His grace, wisdom, and guidance and for giving the author the determination to write this book. This book would not have been possible without the support and help of several individuals who in one way or another contributed and extended their valuable assistance in the preparation and completion of this material. The author offer his regards and blessings to all of those who supported him in any respect during the completion of this book.

Dedication

The author dedicates this book to the ALMIGHTY GOD.

This book is also dedicated to Dennis Ritchie for giving the author the tools to program and to Bill Gates for giving the author the reasons to program.

Chapter 1 - Starting C Language Programming

This chapter presents a brief overview of C language. It presents the things needed in starting C language programming.

Short history of C Language

C is a general-purpose high level language that was originally developed by Dennis Ritchie for the Unix operating system. It was first implemented on the Digital Equipment Corporation PDP-11 computer in 1972. The Unix operating system and virtually all Unix applications are written in the C language. C has now become a widely used professional language for various reasons:

1. Easy to learn.

2. Structured language.

3. Produces efficient programs.

4. It can handle low-level activities.

5. It can be compiled on a variety of computers.

6. It has a low-level language capability with the convenience of high-level programming.

C language was invented to write an operating system called UNIX. C is a successor of B language which was introduced around 1970. The language was formalized in 1988 by the American National Standard Institute (ANSI). By 1973 UNIX OS almost totally written in C. Today C is the most widely used System Programming Language. Most of the state of the art software have been implemented using C language.

Reasons to use C Language

To start with, I highly recommend C language for any beginning programmers to start their programming career because most of the high-level and other popular programming languages today is based from C language. Once you've learned the concepts behind programming language with C, adopting or migrating to other language will be easy as most of the things needed are pretty similar.

C was initially used for system development work, in particular the programs that make-up the operating system. C was adopted as a system development language because it produces code that runs nearly as fast as code written in assembly language. Some examples of the use of C might be:

1. Operating Systems

2. Language Compilers

3. Assemblers

4. Text Editors

4. Print Spoolers

5. Network Drivers

6. Modern Programs

7. Data Bases

8. Language Interpreters

9. Utilities

10. C Program File

Beginning to Program in C Language

All the C programs are written into text files with extension .c for example hello.c, where .c is extension file name. These text files are called source files. The source files contains the C source codes and will later be transformed into a running executable file. The program development cycle of C language are:

1. Write the source codes into a text editor (ex: notepad) to create the source file.

2. Compile the source file to create the object file.

3. The object file is link into an executable (ex: .exe for windows) file.

4. Run the program and see the result.

Based from the program development cycle of C, notice that there are several things needed which includes a text editor, a compiler, and a linker. The good news is that, for Windows users, there is a software that comprises the three. It is called Dev-C++ which is available at http://bloodshed.net and for the download direct link at http://bloodshed-dev-c.en.softonic.com/download.

Dev-C++ is a C source code editor, a compiler, and a linker. All the things needed in creating a C program.

Note: You may ought to use other C compilers.

Installing the

Enjoying the preview?
Page 1 of 1