What Is Java?

Java was originally a programming language invented by Sun Microsystems, by James Gosling. Today Oracle owns Sun, and therefore Java too. Java is thus Oracle’s trademark. Over time Java has evolved into more than just a language. It is a full platform with lots of standard APIs, open source APIs, tools, a big developer community … Read more

Arrays of Structures & Unions in C

Since structures are data types that are especially useful for creating collection items, why not make a collection of them using an array? Similarly, we can create array of Unions. The following code snippet shows how to create an array of structures and access a particular structure element’s member. struct student { int rno; char … Read more

Union: Accessing Union Members & Nesting in C

To access union members we can use dot operator (.) between union variable and union member name as follows: <Union-Variable-Name>.<MemberAddress> For example, to access marks of union student we can do as follows: union student std2; std2.marks = 20; Now, the data member percentage of union student also contains the same value 20 but in … Read more

Union: Definition, Declaration & Initialization in C

Union, is a collection of variables of different types, just like a structure, however a union can only store information in one field at one time. This means, a union can be viewed as a variable type that can contain many different variables as members (like a structure), but only actually holds one of them … Read more

Nesting of Structures in C

A Structure can contain other Structure variables as members. This is called Nesting of Structures. For example address structure is a structure. We can define a nested structure called customer which contains address structure as follows: struct address { int house_number; char street_name[50]; int zip_code; char country[50]; }; struct customer { char name[50]; structure address … Read more

Initialization & Accessing Structure Members in C

C programming language treats a structure as a user-defined data type; therefore you can initialize a structure like a variable. Here is an example of initialize product structure: struct product { char name[50]; double price; } book = { “C programming language”, 40.5 }; In above example, we defined product structure, then we declare and … Read more

Structure Declaration in C

The first way is to declare a structure variable immediately after the structure definition, as follows: struct address { int house_number; char street_name[50]; int zip_code; char country[50]; } struct_var1, struct_var2; In the second way, you can declare the structure variable at a different location after structure definition. Here is structure declaration syntax: struct address { … Read more