<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: A-Shashank</title>
    <description>The latest articles on DEV Community by A-Shashank (@ashashank).</description>
    <link>https://dev.to/ashashank</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F618277%2Fb6a15d11-4082-4175-abb1-93142072fb53.png</url>
      <title>DEV Community: A-Shashank</title>
      <link>https://dev.to/ashashank</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ashashank"/>
    <language>en</language>
    <item>
      <title>Programming with C</title>
      <dc:creator>A-Shashank</dc:creator>
      <pubDate>Mon, 25 Oct 2021 16:25:50 +0000</pubDate>
      <link>https://dev.to/ashashank/programming-with-c-2bcf</link>
      <guid>https://dev.to/ashashank/programming-with-c-2bcf</guid>
      <description>&lt;p&gt;C (Programming Language)&lt;br&gt;
    C is a general-purpose, procedural computer programming language supporting structured programming, lexical variable scope, and recursion, with a static type system. By design, C provides constructs that map efficiently to typical machine instructions. It has found lasting use in applications previously coded in assembly language. Such applications include operating systems and various application software for computer architectures that range from supercomputers to PLCs and embedded systems.&lt;/p&gt;

&lt;p&gt;Data Types:&lt;br&gt;
In the C programming language, data types constitute the semantics and characteristics of storage of data elements. They are expressed in the language syntax in form of declarations for memory locations or variables. Data types also determine the types of operations or methods of processing of data elements. &lt;br&gt;
The C language provides basic arithmetic types, such as integer and real number types, and syntax to build array and compound types. Headers for the C standard library, to be used via include directives, contain definitions of support types, that have additional properties, such as providing storage with an exact size, independent of the language implementation on specific hardware platforms.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--KlS8GbXt--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/wdd0eckta5f6cleqk3bq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--KlS8GbXt--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/wdd0eckta5f6cleqk3bq.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Fundamental Data Types:&lt;br&gt;
A fundamental or primitive type is a data type where the values that it can represent have a very simple nature (a number, a character or a truth-value); the primitive types are the most basic building blocks for any programming language and are the base for more complex data types.There are five types of fundamental data types&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; Integer&lt;/li&gt;
&lt;li&gt; Floating&lt;/li&gt;
&lt;li&gt; Character&lt;/li&gt;
&lt;li&gt; Void&lt;/li&gt;
&lt;li&gt; Boolean&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Integer:&lt;br&gt;
Integers are used to store whole numbers.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--gGCHV7_a--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/dloxfkteuzl1pmo3spwn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--gGCHV7_a--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/dloxfkteuzl1pmo3spwn.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Floating:&lt;br&gt;
Floating types are used to store real numbers.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--JtNmCYCN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/gp1ehow37ylha6x2zj26.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--JtNmCYCN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/gp1ehow37ylha6x2zj26.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Character:&lt;br&gt;
Character types are used to store characters value. &lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--kWCKL-uS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/gubmm04kj2u0h59w9mbf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--kWCKL-uS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/gubmm04kj2u0h59w9mbf.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Void:&lt;br&gt;
void type means no value. This is usually used to specify the type of functions which returns nothing. We will get acquainted to this datatype as we start learning more advanced topics in C language, like functions, pointers etc.&lt;/p&gt;

&lt;p&gt;Boolean:&lt;br&gt;
In C, Boolean is a data type that contains two types of values, i.e., 0 and 1. Basically, the bool type value represents two types of behavior, either true or false. Here, '0' represents false value, while '1' represents true value.&lt;/p&gt;

&lt;p&gt;Syntax :&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--AobP4t5U--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/ufw58r14t81ekzdnh2zf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--AobP4t5U--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/ufw58r14t81ekzdnh2zf.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Derived Data Types:&lt;br&gt;
The functions that we create in a program are known as user defined functions or in other words you can say that a function created by user is known as user defined function. These are five types:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; Functions&lt;/li&gt;
&lt;li&gt; Arrays&lt;/li&gt;
&lt;li&gt; Pointers&lt;/li&gt;
&lt;li&gt; Unions&lt;/li&gt;
&lt;li&gt; Structures
Unions and Structures are classified as User Defined Data Types.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Functions:&lt;br&gt;
A function is a group of statements that together perform a task. Every C program has at least one function, which is main(), and all the most trivial programs can define additional functions.&lt;br&gt;
We can divide up your code into separate functions. How you divide up your code among different functions is up to you, but logically the division is such that each function performs a specific task.&lt;br&gt;
C functions can be classified into two categories,&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; Library functions&lt;/li&gt;
&lt;li&gt; User-defined functions
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--SsoyraeW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/z40qg36w2gkyid5lzyga.jpg" alt="Alt Text"&gt;
Library functions are those functions which are already defined in C library, example printf(), scanf(), strcat() etc. You just need to include appropriate header files to use these functions. These are already declared and defined in C libraries.
User-defined functions on the other hand, are those functions which are defined by the user at the time of writing program. These functions are made for code reusability and for saving time and space.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Defining a Function:&lt;br&gt;
The general form of a function definition in C programming language is as follows −&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--gls9Mc79--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/tawn80jw740iamyf27tu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--gls9Mc79--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/tawn80jw740iamyf27tu.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;br&gt;
A function definition in C programming consists of a function header and a function body. Here are all the parts of a function −&lt;br&gt;
•Return Type − A function may return a value. The return_type is the data type of the value the function returns. Some functions perform the desired operations without returning a value. In this case, the return_type is the keyword void.&lt;br&gt;
•Function Name − This is the actual name of the function. The function name and the parameter list together constitute the function signature.&lt;br&gt;
•Parameters − A parameter is like a placeholder. When a function is invoked, you pass a value to the parameter. This value is referred to as actual parameter or argument. The parameter list refers to the type, order, and number of the parameters of a function. Parameters are optional; that is, a function may contain no parameters.&lt;br&gt;
•Function Body − The function body contains a collection of statements that define what the function does.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--OI4s26m3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/wen060i6hllvd8pjy2ic.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--OI4s26m3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/wen060i6hllvd8pjy2ic.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Function Arguments:&lt;br&gt;
If a function is to use arguments, it must declare variables that accept the values of the arguments. These variables are called the formal parameters of the function.&lt;br&gt;
Formal parameters behave like other local variables inside the function and are created upon entry into the function and destroyed upon exit.&lt;br&gt;
While calling a function, there are two ways in which arguments can be passed to a function &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; Call by Value&lt;/li&gt;
&lt;li&gt; Call by Reference&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Call by Value:&lt;br&gt;
        The call by value method of passing arguments to a function copies the actual value of an argument into the formal parameter of the function. In this case, changes made to the parameter inside the function have no effect on the argument.&lt;br&gt;
By default, C programming uses call by value to pass arguments. In general, it means the code within a function cannot alter the arguments used to call the function.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ScR9vqal--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/mzt4i6q9ekz9a9bnqhe7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ScR9vqal--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/mzt4i6q9ekz9a9bnqhe7.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Call by Reference:&lt;br&gt;
        The call by reference method of passing arguments to a function copies the address of an argument into the formal parameter. Inside the function, the address is used to access the actual argument used in the call. It means the changes made to the parameter affect the passed argument.&lt;br&gt;
To pass a value by reference, argument pointers are passed to the functions just like any other value. &lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--YWFFRTlF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/3jryq6uf743fq3t075p0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--YWFFRTlF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/3jryq6uf743fq3t075p0.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Arrays:&lt;br&gt;
Arrays are referred to as structured data types. An array is defined as finite ordered collection of homogenous data, stored in contiguous memory locations.&lt;br&gt;
Here the words,&lt;br&gt;
•finite means data range must be defined.&lt;br&gt;
•ordered means data must be stored in continuous memory addresses.&lt;br&gt;
•homogenous means data must be of similar data type.&lt;/p&gt;

&lt;p&gt;Declaring Arrays:&lt;br&gt;
     To declare an array in C, a programmer specifies the type of the elements and the number of elements required by an array as follows &lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--r5I2nakO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/u8435hf4og7cqyga684k.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--r5I2nakO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/u8435hf4og7cqyga684k.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--k0Tv555f--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/71wstqv1x8vbeemdjrcb.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--k0Tv555f--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/71wstqv1x8vbeemdjrcb.jpg" alt="Alt Text"&gt;&lt;/a&gt;&lt;br&gt;
Here int is the data type, arr is the name of the array and 10 is the size of array. It means array arr can only contain 10 elements of int type.&lt;br&gt;
Index of an array starts from 0 to size-1 i.e first element of arr array will be stored at arr[0] address and the last element will occupy arr[9].&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--dsZ8V3MG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/gn4lqy78teazdpvkanuf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--dsZ8V3MG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/gn4lqy78teazdpvkanuf.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Two dimensional Arrays:&lt;br&gt;
C language supports multidimensional arrays also. The simplest form of a multidimensional array is the two-dimensional array. Both the row's and column's index begins from 0.&lt;br&gt;
Two-dimensional arrays are declared as follows,&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--TiDLhJLy--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/zpmraczd6rzfc1zb1mvf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--TiDLhJLy--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/zpmraczd6rzfc1zb1mvf.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--pGb9cX63--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/tn4qsgrzao8nykp95mrt.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--pGb9cX63--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/tn4qsgrzao8nykp95mrt.jpg" alt="Alt Text"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--RFaDR_Ay--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/1fa7c6a3jbwgzl46bj06.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--RFaDR_Ay--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/1fa7c6a3jbwgzl46bj06.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Pointers:&lt;br&gt;
A Pointer in C language is a variable which holds the address of another variable of same data type.&lt;/p&gt;

&lt;p&gt;Pointers are used to access memory and manipulate the address.&lt;/p&gt;

&lt;p&gt;Pointers are one of the most distinct and exciting features of C language. It provides power and flexibility to the language. Although pointers may appear a little confusing and complicated in the beginning, but trust me, once you understand the concept, you will be able to do so much more with C language. &lt;/p&gt;

&lt;p&gt;Address in C:&lt;br&gt;
Whenever a variable is defined in C language, a memory location is assigned for it, in which its value will be stored. We can easily check this memory address, using the &amp;amp; symbol.&lt;/p&gt;

&lt;p&gt;If var is the name of the variable, then &amp;amp;var will give it's address.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--nzw2kIA2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/bnymbm5b2cdfvzxxl77o.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--nzw2kIA2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/bnymbm5b2cdfvzxxl77o.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;User-Defined Data Types:&lt;br&gt;
          A user-defined data type (UDT) is a data type that derived from an existing data type. You can use UDTs to extend the built-in types already available and create your own customized data types.There are two types if UDT’s in C Language:&lt;br&gt;
1.Unions&lt;br&gt;
2.Structures&lt;/p&gt;

&lt;p&gt;Unions:&lt;br&gt;
       It is a collection of variables of different datatypes in the same memory location.We can define a union with many members, but at a given point of time only one member can contain a value.Unions can be very handy when you need to talk to peripherals through some memory mapped registers.&lt;/p&gt;

&lt;p&gt;Syntax for Declaring a C union:&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--brhnD8M0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/1lgyqijcps5v8xzjqahs.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--brhnD8M0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/1lgyqijcps5v8xzjqahs.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Note : Size of the union is the the size of its largest field because sufficient number of bytes must be reservedto store the largest sized field.&lt;/p&gt;

&lt;p&gt;To access the fields of a union, use dot(.) operator i.e., the variable name followed by dot operator followed byfield name.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--oUS4GCAN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/rdlav4ijszotu5fyk5ll.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--oUS4GCAN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/rdlav4ijszotu5fyk5ll.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Structures:&lt;br&gt;
Structure is a user-defined datatype in C language which allows us to combine data of different types together. Structure helps to construct a complex data type which is more meaningful. It is somewhat similar to an Array, but an array holds data of similar type only. But structure on the other hand, can store data of any type, which is practical more useful.&lt;/p&gt;

&lt;p&gt;Defining a structure:&lt;br&gt;&lt;br&gt;
struct keyword is used to define a structure. struct defines a new data type which is a collection of primary and derived datatypes.&lt;/p&gt;

&lt;p&gt;Syntax:&lt;br&gt;
As you can see in the syntax above, we start with the struct keyword, then it's optional to provide your structure a name, we suggest you to give it a name, then inside the curly braces, we have to mention all the member variables, which are nothing but normal C language variables of different types like int, float, array etc.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Dwi0Sc7t--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/uxn28pknn920rj5k60zs.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Dwi0Sc7t--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/uxn28pknn920rj5k60zs.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;br&gt;
After the closing curly brace, we can specify one or more structure variables, again this is optional.&lt;/p&gt;

&lt;p&gt;Note: The closing curly brace in the structure type declaration must be followed by a semicolon(;).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--f5rKhLcz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/qv0cw34doc89tgmdt0hf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--f5rKhLcz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/qv0cw34doc89tgmdt0hf.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Difference between Unions and Structures:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--lBHG4Gk4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/mwon3mcpx6sprzu2j4ka.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--lBHG4Gk4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/mwon3mcpx6sprzu2j4ka.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Object Oriented Programming</title>
      <dc:creator>A-Shashank</dc:creator>
      <pubDate>Sat, 08 May 2021 16:42:30 +0000</pubDate>
      <link>https://dev.to/ashashank/object-oriented-programming-579a</link>
      <guid>https://dev.to/ashashank/object-oriented-programming-579a</guid>
      <description>&lt;p&gt;Object-oriented programming (OOP) is a fundamental programming paradigm used by nearly every developer at some point in their career. OOP is the most popular programming paradigm and is taught as the standard way to code for most of a programmers educational career.&lt;/p&gt;

&lt;p&gt;Today we will break down the basics of what makes a program object-oriented so that you can start to utilize this paradigm in your own projects and interviews.&lt;/p&gt;

&lt;p&gt;What is Object Oriented Programming?&lt;/p&gt;

&lt;p&gt;Object Oriented programming (OOP) is a programming paradigm that relies on the concept of classes and objects. It is used to structure a software program into simple, reusable pieces of code blueprints (usually called classes), which are used to create individual instances of objects. There are many object-oriented programming languages including JavaScript, C++, Java, and Python.&lt;/p&gt;

&lt;p&gt;A class is an abstract blueprint used to create more specific, concrete objects. Classes often represent broad categories, like Car or Dog that share attributes. These classes define what attributes an instance of this type will have, like color, but not the value of those attributes for a specific object.&lt;/p&gt;

&lt;p&gt;Classes can also contain functions, called methods available only to objects of that type. These functions are defined within the class and perform some action helpful to that specific type of object.&lt;/p&gt;

&lt;p&gt;What is Object Oriented Programming? OOP Explained in Depth&lt;br&gt;
Apr 15, 2020 - 15 min read&lt;br&gt;
Erin Doherty&lt;br&gt;
editor-page-cover&lt;/p&gt;

&lt;p&gt;Object-oriented programming (OOP) is a fundamental programming paradigm used by nearly every developer at some point in their career. OOP is the most popular programming paradigm and is taught as the standard way to code for most of a programmers educational career.&lt;/p&gt;

&lt;p&gt;Today we will break down the basics of what makes a program object-oriented so that you can start to utilize this paradigm in your own projects and interviews.&lt;/p&gt;

&lt;p&gt;What is Object Oriented Programming?&lt;/p&gt;

&lt;p&gt;Object Oriented programming (OOP) is a programming paradigm that relies on the concept of classes and objects. It is used to structure a software program into simple, reusable pieces of code blueprints (usually called classes), which are used to create individual instances of objects. There are many object-oriented programming languages including JavaScript, C++, Java, and Python.&lt;/p&gt;

&lt;p&gt;A class is an abstract blueprint used to create more specific, concrete objects. Classes often represent broad categories, like Car or Dog that share attributes. These classes define what attributes an instance of this type will have, like color, but not the value of those attributes for a specific object.&lt;/p&gt;

&lt;p&gt;Classes can also contain functions, called methods available only to objects of that type. These functions are defined within the class and perform some action helpful to that specific type of object.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;For example, our Car class may have a method repaint that changes the color attribute of our car. This function is only helpful to objects of type Car, so we declare it within the Car class thus making it a method.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Class templates are used as a blueprint to create individual objects. These represent specific examples of the abstract class, like myCar or goldenRetriever. Each object can have unique values to the properties defined in the class.&lt;/p&gt;

&lt;p&gt;Benefits of OOP&lt;/p&gt;

&lt;p&gt;OOP models complex things as reproducible, simple structures.&lt;br&gt;
Reusable, OOP objects can be used across programs.&lt;br&gt;
Allows for class-specific behavior through polymorphism.&lt;br&gt;
Easier to debug, classes often contain all applicable information to them.&lt;br&gt;
Secure, protects information through encapsulation.&lt;/p&gt;

&lt;p&gt;Grouping related information together to form a class structure makes the code shorter and easier to maintain.&lt;/p&gt;

&lt;p&gt;In the dogsitting example, here’s how a programmer could think about organizing an OOP:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Create a parent class for all dogs as a blueprint of information and behaviors (methods) that all dogs will have, regardless of type.

Create child classes to represent different subcategories of dog under the generic parent blueprint.

Add unique attributes and behaviors to the child classes to represent differences

Create objects from the child class that represent dogs within that subgroup
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;The diagram below represents how to design an OOP program: grouping the related data and behaviors together to form a simple template then creating subgroups for specialized data and behavior.&lt;/p&gt;

&lt;p&gt;The Dog class is a generic template, containing only the structure about data and behaviors common to all dogs.&lt;/p&gt;

&lt;p&gt;We then create two child classes of Dog, HerdingDog and TrackingDog. These have the inherited behaviors of Dog (bark()) but also behavior unique to dogs of that subtype.&lt;/p&gt;

&lt;p&gt;Finally,we create objects of the HerdingDog type to represent the individual dogs Fluffy and Maisel.&lt;/p&gt;

&lt;p&gt;We can also create objects like Rufus that fit under the broad class of Dog but do not fit under either HerdingDog or TrackingDog.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--KN9Dr0zj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/q5x8c5cg4ku85cnmrk9z.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--KN9Dr0zj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/q5x8c5cg4ku85cnmrk9z.jpg" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Building blocks of OOP:&lt;/p&gt;

&lt;p&gt;Next, we’ll take a deeper look at each of the fundamental building blocks of an OOP program used above:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Classes
Objects
Methods
Attributes
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
    </item>
  </channel>
</rss>
