C Examples – Arrays

Array Example Programs in C ”; Previous Next 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. Program to print an array Program to print an array in reverse order Program to calculate sum of an array Program to calculate average of an array Program to find the largest element of an array Program to find the second largest element of an array Program to find the smallest element of an array 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. Program to copy an array to another array Program to copy an array to another array in reverse Program to divide one array into two arrays Program to concatenate arrays Print Page Previous Next Advertisements ”;

C Examples – Loops/Iterations

Loop Examples in C ”; Previous Next 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 − Simple Counting program in C Table of Counting program in C Table program in C Table of tables program in C Revere counting program in C Printing even values in a loop Printing odd values in a loop Print Page Previous Next Advertisements ”;

Learn C By Examples – Quick Guide

Learn C By Examples – Quick Guide ”; Previous Next 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. “Hello World!” program in C Variables in C Arithmetic Operations 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. Compare two integers Compare three integers Find if a given number is even or odd Find if a given number is positive or negative Find if a year is leap year or not Swapping values using third variable Swapping values without using third variable 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 − Simple Counting program in C Table of Counting program in C Table program in C Table of tables program in C Revere counting program in C Printing even values in a loop Printing odd values in a loop 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. Equilateral triangle printing in C Right triangle printing in C Up-side down triangle printing in C Top down triangle printing in C Top down right triangle printing in C Floyd”s triangle printing in C Pascal”s triangle printing in C 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. Program to print an array Program to print an array in reverse order Program to calculate sum of an array Program to calculate average of an array Program to find the largest element of an array Program to find the second largest element of an array Program to find the smallest element of an array 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. Program to copy an array to another array Program to copy an array to another array in reverse Program to divide one array into two arrays Program to concatenate arrays 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. Program to print a string in C Program to print a string character by character in C Program to find string length without function in C Program to count character occurrent in C Program to count vowels occurrent in C Program to sort string characters in C 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 − Program to copy string in C Program to reverse string in C Program to search strings in C Program to swap strings in C Program to compare two strings in C Program to concatenate two strings in C String Anagram program in in C Long String Programs A sentence or a line can be considered as a long string. The following programs deals with the same concept − C Program to reverse words in a line C Program to reverse a line 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. Armstrong Number Prime Number Factorial Number Fibonacci Series Average Here we shall learn how to program to find average and percentages. Average Percentage 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

Learn C By Examples – Resources

Learn C By Examples – Useful Resources ”; Previous Next The following resources contain additional information on Learn C By Examples. Please use them to get more in-depth knowledge on this topic. Useful Links on Learn C By Examples Compile and Execute C Online − High end server giving opportunity to compile and execute C progams online. Notes on K&R2 − A great companion to K&R2 Programming in C − Literature, History and Culture of C Programming Language. Learn GNU Debugger – GDB − A debugging tool to debug errors in C and C++ programs. Unix Makefile − A file that instructs the program make how to compile and link a C or C++ program. C++ tutorial − If you are done with C programming language then its time to jump to C++ Useful Books on Learn C By Examples To enlist your site on this page, please drop an email to [email protected] Print Page Previous Next Advertisements ”;

Learn C By Examples – Discussion

Discuss Learn C By Examples ”; Previous Next C is a general-purpose, procedural, imperative computer programming language developed in 1972 by Dennis M. Ritchie at the Bell Telephone Laboratories to develop the UNIX operating system. C is the most widely used computer language. It keeps fluctuating at number one scale of popularity along with Java programming language, which is also equally popular and most widely used among modern software programmers. Print Page Previous Next Advertisements ”;

C Examples – Linked List

Linked List Programs in C ”; Previous Next 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. Create Linked List Display Linked List in Reverse Find size of Linked List Search an Item in Linked List Update an Item in Linked List Remove an Item from Linked List Combine Two Linked List Split Linked List into two 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. Create Linked List Display Linked List in Reverse Find size of Linked List Search an Item in Linked List Update an Item in Linked List Remove an Item from Linked List Combine Two Circular Linked List Split Linked List into two Doubly Linked List Doubly Linked List is a variation of Linked list in which navigation is possible in both ways either forward and backward. Create Linked List Display Linked List in Reverse Find size of Linked List Search an Item in Linked List Update an Item in Linked List Remove an Item from Linked List Combine Two Doubly Linked List Split Linked List into two Print Page Previous Next Advertisements ”;

C Examples – Simple Programs

Small & Simple Programs in C ”; Previous Next 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. “Hello World!” program in C Variables in C Arithmetic Operations 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. Compare two integers Compare three integers Find if a given number is even or odd Find if a given number is positive or negative Find if a year is leap year or not Swapping values using third variable Swapping values without using third variable Print Page Previous Next Advertisements ”;

Learn C by Examples – Home

Learn C By Examples Tutorial Quick Guide Resources Job Search Discussion C is a general-purpose, procedural, imperative computer programming language developed in 1972 by Dennis M. Ritchie at the Bell Telephone Laboratories to develop the UNIX operating system. C is the most widely used computer language. It keeps fluctuating at number one scale of popularity along with Java programming language, which is also equally popular and most widely used among modern software programmers. Audience This tutorial is designed for software programmers with a need to understand the C programming language starting from scratch. This tutorial will give you enough understanding on C programming language from where you can take yourself to higher level of expertise. Prerequisites Before proceeding with this tutorial, you should have a basic understanding of Computer Programming terminologies. A basic understanding of any of the programming languages will help you in understanding the C programming concepts and move fast on the learning track. Print Page Previous Next Advertisements ”;

C Examples – Patterns

Patterns Examples in C ”; Previous Next 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. Equilateral triangle printing in C Right triangle printing in C Up-side down triangle printing in C Top down triangle printing in C Top down right triangle printing in C Floyd”s triangle printing in C Pascal”s triangle printing in C Print Page Previous Next Advertisements ”;