Nested Struct

Structure within a structure is called nested structure. There are two methods for declaring structure within a structure. Those are listed below. Normally the main structure is called the outer structure and the nested structure is called the inner structure. Method 1 Declaring inner structure outside outer structure and declaring a variable of inner structure…

Usage of Struct

To declare a structure first we have to write the keyword “struct”. Then we have to write a user-defined name of the structure. After that, members of the structure are declared in curly braces. The end of the structure is shown by the semicolon “;”. The members are nothing but just declaring simple variables with…

Structure in C

As the array is used to make variables of the same data type and can be accessed by the same name but different index. The structure is used to make variables which have different variables of different data types (which are called structure members). Let us understand by an example. Ex1 is showing an array…

Register

We can understand all storage classes by differentiating all of those according to their default value, keyword, storage, scope, life. Which are listed in the table below. Storage Class Keyword Default Value Storage Scope Life Automatic auto Garbage RAM Limited to block in which it is declared Till execution of block in which it is…

Storage Class

Storage class is an addition to data type of a variable. It is optional to define. But to give an extra attribute to variable, it is used. As per its different types, it is used for some specific application of a variable. <storage class keyword>   <data type>   <variable name>; Types of storage class 1.Automatic 2.Register…

String Handling

There are many library function for string handling. To use that we have to include string library , which we can do by writing #include<string.h>. One by one we are going to discuss library function and other method to perform same task without using library function. strlen : string length  This function is used to…

Passing Array to Functions

A name of an array gives the address of the 0th element of that array, passing the array name is the same as passing the address to the function. It means if there is an array of 3 elements (ex. arr[3]), so to pass the address of array as argument of a function, we can…

Array of String

Definition An array of characters is called string. Ex. One wants to store the name “RAMAN”, then he wants 5 char variables. “R” will be stored in 1st char variable, “A” in 2nd char variable and so on. So to store the whole name “RAMAN” in one variable, we can use char array up to…

Multi Dimensional Arrays

Definition The multidimensional array will have multiple indexes, like a 2-Dimensional array will have 2 indexes and a 3-Dimensional array will have 3 indexes. A 2-D array is used when we want to take data in the form of rows and columns. In the 2-D array, the 1st index shows the number of rows and…