Learn C By Examples – Quick Guide


Learn C By Examples – Quick Guide


”;


Small & Simple Programs in C

Let”s first start with very small & simple programs to get basic idea of C programming code structure. We shall get the basic idea of variable declaration, scanning and printing etc.

Basic Programs

We shall see the classic “Hello World!” program to get an insight of how a program is written in c. We have programs on variables available in c. These are most commonly used elementary variables. Also, we shall see how arithmetic operations can be performed in a c program.

General Programs

There are programs which we use in our routine, or say a programmer”s routine. These programs are easy to understand and should help in understanding style of C programming. We shall see here some of these programs and some cool tricks.

Loop Examples in C

This segment is designed to give the learner an enhanced view of how loops work in c languages. We shall see simple loops like for, while and do-while, along with nested loops.

Simple Loop Programs

Lets see some simple loop program we use in day-to-day life −

Patterns Examples in C

This section is full of examples that uses nested loops in a controlled manner. We may see that the outer loop is controlling the inner one etc. We have taken the simplest examples which are very common too.

Array Example Programs in C

Array is a collection of homogenous data, arranged in sequential format. Learning the concept of arrays in C is very important as it is the basic data structure. Here, in this section, we shall look into some very useful array programs to give you insight of how C programming language deals with arrays.

Single Array Programs

These programs are basic and involves only a single array variable. We shall learn how to handle array variable in different situation.

Multi Array Programs

These programs involve more than one array. This section should give you some easy techniques to handle more than one array variables in a program.

String Programs in C

Strings are actually one-dimensional array of characters terminated by a null character ””. Thus a null-terminated string contains the characters that comprise the string followed by a null.

The following declaration and initialization create a string consisting of the word “Hello”. To hold the null character at the end of the array, the size of the character array containing the string is one more than the number of characters in the word “Hello.”

char greeting[6] = {''H'', ''e'', ''l'', ''l'', ''o'', ''''};

If you follow the rule of array initialization then you can write the above statement as follows −

char greeting[] = "Hello";

In this section, we shall learn how to work with string C programming language. We have divided the examples in multiple sub-sections to have a better understanding of what we are doing −

Basic Programs

These programs made specially to understand the basics of strings in C. These program deals with string as an array of characters.

Multi-string Programs

These programs has more than one string variables. These should give you an insight of how to work with multiple string variables in C programming language −

Long String Programs

A sentence or a line can be considered as a long string. The following programs deals with the same concept −

Mathematical Programs in C

This section has been developed to introduce some common mathematical problems that can be solved using c programming language.

Numbers & Series

Lets start with some designated number and series to program. Here we shall see how to program to get Armstrong, Prime, Factorial numbers and Fibonacci series.

Average

Here we shall learn how to program to find average and percentages.

Mean, Median & Mode

All three of mean, median and mode are types of different kind of averages. Mean deals with common way of finding average. Median is the centeral value of a list and mode is a value in a list which occurs the highest number of time.

General Programs

Some basic and general programs learnt in schools can provide us an insight of programming techniques. Here we shall see few of the general programs used in school mathematics.

Linked List Programs in C

A linked-list is a sequence of data structures which are connected together via links.

Linked List is a sequence of links which contains items. Each link contains a connection to another link. Linked list the second most used data structure after array. Following are important terms to understand the concepts of Linked List.

  • Link − Each Link of a linked list can store a data called an element.

  • Next − Each Link of a linked list contain a link to next link called Next.

  • LinkedList − A LinkedList contains the connection link to the first Link called First.

Here in this section we shall learn basic programming techniques using linked-lists.

Simple (Singly) Linked List

This linked list has sequential one-way connection with adjacent nodes. It can only be parsed one-way. Here we shall learn the basic operation of singly list list.

Circular Linked List

Circular Linked List is a variation of Linked list in which first element points to last element and last element points to first element.

Doubly Linked List

Doubly Linked List is a variation of Linked list in which navigation is possible in both ways either forward and backward.

Advertisements

”;

Leave a Reply

Your email address will not be published. Required fields are marked *