C Programming

   »   

Computer Education, Training & Tutorial Resources - ComputerEducationWorld.com
Home » Free Educations » Free Programming Training » C Programming »

 Enumerated types contain a list of constants that can be addressed in integer values. The idea behind enumerated types is to create new data types that can take on only a restricted range of values. Moreover, these values are all expressed as constants rather than magic numbers in fact, there should be no need to know the underlying values. The names of the constants should be sufficient for the purposes of comparing values.

Example 1:
enum month { jan = 1, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec };
enum month this_month;

this_month = feb;

In the above declaration, month is declared as an enumerated data type. It consists of a set of values, jan to dec. Numerically, jan is given the value 1, feb the value 2, and so on.

Example 2:
enum { Sunday, Monday, Tuesday, Wednesday, Thursday, Friday,
Saturday } weekday;


• • •
 

Structure 

A structure is a collection of variables under a single name. These variables can be of different types, and each has a name which is used to select it from the structure. A structure is a convenient way of grouping several pieces of related information together.

A structure is combination of different data types. Structs are generally useful whenever a lot of data needs to be grouped together–for instance, (more…)


• • •
 

An array is a collection of objects of the same data type.  The subscripting operator ([]) provides the mechanics for creating an index to array elements. This form of access is called indexing or subscripting. An array facilitates the coding of repetitive tasks by allowing the statements executed on each element to be put into a loop that iterates through each element in the array. (more…)


• • •
 

printf offers more structured output than putchar. Its arguments are, in order; a control string, which controls what gets printed, followed by a list of values to be substituted for entries in the control string. (more…)


• • •
 



captcha PHP Script Free PHP captcha script free php
Website Design by WebWalas.com