<?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: Rishabh Kumar</title>
    <description>The latest articles on DEV Community by Rishabh Kumar (@codewithrish).</description>
    <link>https://dev.to/codewithrish</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%2F790010%2Fc7ef6c72-071e-4e9d-966c-ac7622211e4d.jpg</url>
      <title>DEV Community: Rishabh Kumar</title>
      <link>https://dev.to/codewithrish</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/codewithrish"/>
    <language>en</language>
    <item>
      <title>Getting Started With Kotlin</title>
      <dc:creator>Rishabh Kumar</dc:creator>
      <pubDate>Tue, 09 Aug 2022 18:07:53 +0000</pubDate>
      <link>https://dev.to/codewithrish/getting-started-with-kotlin-1ca4</link>
      <guid>https://dev.to/codewithrish/getting-started-with-kotlin-1ca4</guid>
      <description>&lt;h2&gt;
  
  
  What is Kotlin
&lt;/h2&gt;

&lt;p&gt;Kotlin is general purpose, statically types and open source programming language. It uses &lt;strong&gt;JVM&lt;/strong&gt;. Now a days majorly used to develop &lt;strong&gt;Android Apps&lt;/strong&gt; can also be used in backend &lt;strong&gt;Ktor&lt;/strong&gt; and have many other use cases.&lt;/p&gt;

&lt;h2&gt;
  
  
  Core Features of Kotlin
&lt;/h2&gt;

&lt;p&gt;Kotlin is concise and provides null safety out of box. It is also Interoperable means you can call &lt;strong&gt;&lt;em&gt;Java code from Kotlin&lt;/em&gt;&lt;/strong&gt; and vice-versa. We also get extension function, we will learn everything in this Kotlin blog series.&lt;/p&gt;

&lt;h2&gt;
  
  
  Setup Environment
&lt;/h2&gt;

&lt;p&gt;Install &lt;strong&gt;JDK-JVM&lt;/strong&gt; &lt;a href="https://www.oracle.com/java/technologies/downloads/"&gt;Link to Download&lt;/a&gt; and install &lt;strong&gt;Intellij IDEA&lt;/strong&gt; community version &lt;a href="https://www.jetbrains.com/idea/download/#section=mac"&gt;Link to Download&lt;/a&gt; now setup environment if you don't know how to follow the &lt;a href="https://stackoverflow.com/questions/1672281/how-to-set-the-environment-variables-for-java-in-windows"&gt;Link&lt;/a&gt; that's it you are good to go.&lt;/p&gt;

&lt;h2&gt;
  
  
  Let's Write First Program In Kotlin
&lt;/h2&gt;

&lt;p&gt;Create Kotlin Project in &lt;strong&gt;Intellij IDEA&lt;/strong&gt; and type following code in the editor&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;fun main() {
    println("Hello World!")
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Press run button looks like play button on top of you IDE&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--8gWlrHcQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2zqorbblkz67ibrkxgcg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--8gWlrHcQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2zqorbblkz67ibrkxgcg.png" alt="Intellij IDEA" width="880" height="572"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;That's All you just wrote your first Kotlin program few more to go :P then you will be ready to understand Android Codes and Modern Programming Architecture. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Kotlin Program starts from &lt;strong&gt;main&lt;/strong&gt; function and we use &lt;em&gt;println()&lt;/em&gt; function to print with new line character and simple &lt;em&gt;print()&lt;/em&gt; to print in single line.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>kotlin</category>
      <category>programming</category>
      <category>beginners</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Create Zoom Video Call Clone With WebRTC</title>
      <dc:creator>Rishabh Kumar</dc:creator>
      <pubDate>Wed, 09 Feb 2022 08:21:57 +0000</pubDate>
      <link>https://dev.to/codewithrish/create-zoom-video-call-clone-with-webrtc-545c</link>
      <guid>https://dev.to/codewithrish/create-zoom-video-call-clone-with-webrtc-545c</guid>
      <description>&lt;h1&gt;
  
  
  What is WebRTC
&lt;/h1&gt;

&lt;p&gt;WebRTC is a free and open-source project providing web browsers and mobile applications with real-time communication via application programming interfaces (APIs). You can transfer your audio, video, or data stream directly peer-to-peer via WebRTC. &lt;/p&gt;

&lt;h1&gt;
  
  
  PeerJs
&lt;/h1&gt;

&lt;p&gt;PeerJS wraps the browser's WebRTC implementation to provide a complete, configurable, and easy-to-use peer-to-peer connection API. Equipped with nothing but an ID, a peer can create a P2P data or media stream connection to a remote peer.&lt;/p&gt;

&lt;p&gt;Enough Talks let's make our application &lt;/p&gt;

&lt;h1&gt;
  
  
  Create Simple HTML Page With Two Video Elements &lt;code&gt;index.html&lt;/code&gt;
&lt;/h1&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;!DOCTYPE html&amp;gt;
&amp;lt;html lang="en"&amp;gt;
  &amp;lt;head&amp;gt;
    &amp;lt;title&amp;gt;Video Call&amp;lt;/title&amp;gt;
    &amp;lt;link rel="shortcut icon" href="#" /&amp;gt;
    &amp;lt;link rel="stylesheet" href="style.css" /&amp;gt;
    &amp;lt;script
      defer
      src="https://cdnjs.cloudflare.com/ajax/libs/peerjs/1.3.2/peerjs.min.js"
    &amp;gt;&amp;lt;/script&amp;gt;
    &amp;lt;script defer src="main.js"&amp;gt;&amp;lt;/script&amp;gt;
  &amp;lt;/head&amp;gt;
  &amp;lt;body&amp;gt;
    &amp;lt;div id="wrapper"&amp;gt;
      &amp;lt;video id="local-video" width="400" height="300" autoplay muted&amp;gt;&amp;lt;/video&amp;gt;
      &amp;lt;video id="remote-video" width="400" height="300" autoplay&amp;gt;&amp;lt;/video&amp;gt;
      &amp;lt;div class="clear"&amp;gt;&amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;
  &amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Put Some CSS to place Them Side by Side  &lt;code&gt;style.css&lt;/code&gt;
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#wrapper {
  width: 920px;
  height: auto;
  margin: 0 auto;
}
#local-video {
  width: 47.5%;
  height: 300px;
  float: left;
  margin-right: 5%;
}

#remote-video {
  width: 47.5%;
  height: 300px;
  float: left;
}

.clear {
  clear: both;
}

@media (max-width: 767px) {
  #wrapper {
    width: 100%;
    height: auto;
  }
  #local-video {
    width: 100%;
    height: auto;
    float: none;
  }
  #remote-video {
    width: 100%;
    height: auto;
    float: none;
  }
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Let's Code Our JavaScript for PeerJs &lt;code&gt;main.js&lt;/code&gt;
&lt;/h1&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let localVideo = document.getElementById("local-video");
let remoteVideo = document.getElementById("remote-video");

// Video and audio are enabled for this call.

let peer, localStream;
let MediaConfigurtion = {
  audio: true,
  video: true,
};

// Initialize peer object with userId

function init(userId) {
  peer = new Peer(userId);
  peer.on("open", () =&amp;gt; {
    console.log(`user connected with userID = ${userId}`);
  });
  listenCall();
}

// Get the user media (camera and microphone) for the call.

function makeCall(friendId) {
  var getUserMedia =
    navigator.getUserMedia ||
    navigator.webkitGetUserMedia ||
    navigator.mozGetUserMedia;
  getUserMedia(MediaConfigurtion, (stream) =&amp;gt; {
    localVideo.srcObject = stream;
    localStream = stream;

    const call = peer.call(friendId, stream);
    call.on("stream", (remoteStream) =&amp;gt; {
      remoteVideo.srcObject = remoteStream;
    });
  });
}

// navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.msGetUserMedia;

function listenCall() {
  var getUserMedia =
    navigator.getUserMedia ||
    navigator.webkitGetUserMedia ||
    navigator.mozGetUserMedia;
  peer.on("call", (call) =&amp;gt; {
    getUserMedia(MediaConfigurtion, (stream) =&amp;gt; {
      localVideo.srcObject = stream;
      locaStream = stream;
      call.answer(stream);
      call.on("stream", (remoteStream) =&amp;gt; {
        remoteVideo.srcObject = remoteStream;
      });
    });
  });
}

// Call init with random UUID
init(getUID());

// generate a random UUID string.
function getUID() {
  return ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, (c) =&amp;gt;
    (
      c ^
      (crypto.getRandomValues(new Uint8Array(1))[0] &amp;amp; (15 &amp;gt;&amp;gt; (c / 4)))
    ).toString(16)
  );
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That's it open your &lt;code&gt;index.html&lt;/code&gt; on your browser open your console you will see your unique UID1 say &lt;code&gt;user 1&lt;/code&gt;. Now just open the same file in another tab will be a new client now open console and you will see the unique UID2 of &lt;code&gt;user 2&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--1SSRVf8V--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1644391712883/iXY0j4G07.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--1SSRVf8V--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1644391712883/iXY0j4G07.png" alt="users.png" width="880" height="495"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now Call &lt;code&gt;makeCall&lt;/code&gt; function in user 1 console like this &lt;code&gt;makeCall("UID2")&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--_dWBwpGS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1644391807800/D2gPe0vaR.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--_dWBwpGS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1644391807800/D2gPe0vaR.png" alt="make call.png" width="880" height="495"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Just press enter and you will see the following screen&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--VWp6CLnp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1644392066620/n6iXVCD51.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--VWp6CLnp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1644392066620/n6iXVCD51.png" alt="calling.png" width="880" height="495"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;That's it now both the users are video calling live. Using WebRTC peer-to-peer.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Format Specifiers and Escape Sequence in C Language</title>
      <dc:creator>Rishabh Kumar</dc:creator>
      <pubDate>Tue, 01 Feb 2022 14:05:59 +0000</pubDate>
      <link>https://dev.to/codewithrish/format-specifiers-and-escape-sequence-in-c-language-3m8d</link>
      <guid>https://dev.to/codewithrish/format-specifiers-and-escape-sequence-in-c-language-3m8d</guid>
      <description>&lt;h1&gt;
  
  
  What is Format Specifier
&lt;/h1&gt;

&lt;p&gt;The format specifier is a way to tell your compiler what type of data are you dealing with. It is used while inputting and outputting any data. For all format specifiers, you can check this &lt;a href="https://cdn.hashnode.com/res/hashnode/image/upload/v1643123291697/zwAw5c5m3.png?auto=compress,format&amp;amp;format=webp"&gt;chart&lt;/a&gt; or complete article &lt;a href="https://www.codewithrish.com/data-types-and-variables-in-c"&gt;here&lt;/a&gt; &lt;/p&gt;

&lt;h1&gt;
  
  
  General Syntax in printf()
&lt;/h1&gt;

&lt;blockquote&gt;
&lt;p&gt;printf("%a.b{formatSpecifier}", yourvariable); &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;where &lt;code&gt;a&lt;/code&gt; and &lt;code&gt;b&lt;/code&gt; are integers where a tells total character spaces for output and b tells the accuracy after the decimal.&lt;/p&gt;

&lt;p&gt;Let's look at this code for more details&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#include &amp;lt;stdio.h&amp;gt;
int main()
{
    float b = 5.63;
    printf("%6.3f\n", b);
    return 0;
}
// output
 5.630
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the above code, there &lt;code&gt;a=6&lt;/code&gt; and &lt;code&gt;b=3&lt;/code&gt; means we will have 3 decimal places and if we look closely there is 1 space before 5 in the output 4 character spaces by &lt;code&gt;5&lt;/code&gt;, &lt;code&gt;6&lt;/code&gt;, &lt;code&gt;3&lt;/code&gt; and &lt;code&gt;0&lt;/code&gt; and fifth by &lt;code&gt;.&lt;/code&gt; but we said 6 so it added a space before because a was positive if a would have been negative it will add spaces after the output.&lt;/p&gt;

&lt;h1&gt;
  
  
  General Syntax in scanf()
&lt;/h1&gt;

&lt;blockquote&gt;
&lt;p&gt;scanf("%{formatSpecifier}", &amp;amp;yourvariable); &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Sample Code&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#include &amp;lt;stdio.h&amp;gt;
int main(){    
    float a;
    printf("Enter a number: ");
    scanf("%f", &amp;amp;a);
    printf("Your Input Is: %7.3f", a);
    return 0;  
}    
// output
Enter a number: 5.32
Your Input Is:   5.320
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  What is Escape Sequence
&lt;/h1&gt;

&lt;p&gt;In C, an escape sequence is a character sequence that cannot be used directly in a string literal. You need more character starting with backslash . For example, \n represents new line.&lt;/p&gt;

&lt;h2&gt;
  
  
  List of Escape Sequence in C
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--v_fc20H1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1643722830752/It7PPrh20.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--v_fc20H1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1643722830752/It7PPrh20.png" alt="Escape Sequence.png" width="720" height="1080"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Sample Code&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#include &amp;lt;stdio.h&amp;gt;
#include&amp;lt;stdio.h&amp;gt;    
int main(){    
    int number=50;    
    printf("We\nareC\b learning\t\"C\" programming here \'on\' CodeWithRish");
    return 0;  
}    
// output
We
are learning    "C" programming here 'on' CodeWithRish
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
    </item>
    <item>
      <title>Operators in C Programming with Examples</title>
      <dc:creator>Rishabh Kumar</dc:creator>
      <pubDate>Sun, 30 Jan 2022 09:01:05 +0000</pubDate>
      <link>https://dev.to/codewithrish/operators-in-c-programming-with-examples-55n1</link>
      <guid>https://dev.to/codewithrish/operators-in-c-programming-with-examples-55n1</guid>
      <description>&lt;h1&gt;
  
  
  What is Operator
&lt;/h1&gt;

&lt;p&gt;An &lt;code&gt;Operator&lt;/code&gt; in computer programming is a symbol that helps us to perform mathematical and logical operations. We have 6 types of operators in C&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Arithmetic Operators&lt;/li&gt;
&lt;li&gt;Relational Operators&lt;/li&gt;
&lt;li&gt;Logical Operators&lt;/li&gt;
&lt;li&gt;Bitwise Operators&lt;/li&gt;
&lt;li&gt;Assignment Operators&lt;/li&gt;
&lt;li&gt;Misc Operators&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now we will learn every type of operator in detail. Let's get started :&lt;/p&gt;

&lt;h2&gt;
  
  
  Arithmetic Operators
&lt;/h2&gt;

&lt;p&gt;As the name suggests &lt;code&gt;Arithmetic Operators&lt;/code&gt; helps us to perform arithmetic operations in c Programming. Look at the table to get more ideas about Arithmetic Operators.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Y1WDXZiE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/a3t384iyelzpswab2jwk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Y1WDXZiE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/a3t384iyelzpswab2jwk.png" alt="Image description" width="880" height="462"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Sample Code
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#include &amp;lt;stdio.h&amp;gt;
int main()
{
    int a = 36;
    int b = 5;
    printf("a + b = %d\n", a + b);
    printf("a - b = %d\n", a - b);
    printf("a * b = %d\n", a * b);
    printf("a / b = %d\n", a / b);
    printf("a %% b = %d\n", a % b);
    return 0;
}

// Output
a + b = 41
a - b = 31
a * b = 180
a / b = 7
a % b = 1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Relational Operators
&lt;/h2&gt;

&lt;p&gt;Relational Operators helps us to figure out certain relations between two operands.  It returns true or false based on whether the condition is true or false. And in the C language true and false are represented by &lt;code&gt;1 and 0&lt;/code&gt; respectively. Let's understand how to work with Relational Operators using the table below.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--bvwDUKZ5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1643528806023/eFIu-vsbkz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--bvwDUKZ5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1643528806023/eFIu-vsbkz.png" alt="==.png" width="720" height="1080"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Sample Code
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#include &amp;lt;stdio.h&amp;gt;
int main()
{
    int a = 36;
    int b = 5;
    int c = 5;
    printf("%d\n", a == b);
    printf("%d\n", b == c);
    return 0;
}
// Output
0
1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Logical Operators
&lt;/h2&gt;

&lt;p&gt;Logical Operators are used to checking the &lt;code&gt;and&lt;/code&gt;, &lt;code&gt;or&lt;/code&gt; and &lt;code&gt;not&lt;/code&gt; conditions between two statements or operands. Let's look at the table.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--t0Mbb9iJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1643529534110/JIzDs8PIe.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--t0Mbb9iJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1643529534110/JIzDs8PIe.png" alt="&amp;amp;&amp;amp;.png" width="880" height="462"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Sample Code
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#include &amp;lt;stdio.h&amp;gt;
int main()
{
    int a = 36;
    int b = 5;
    int c = 0;
    printf("%d\n", a &amp;amp;&amp;amp; b);
    printf("%d\n", b &amp;amp;&amp;amp; c);
    printf("%d\n", b || c);
    return 0;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Bitwise Operators
&lt;/h2&gt;

&lt;p&gt;As the name suggests bitwise operator returns the value by comparing two operands bit by bit after converting it to binary.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--rZ3-z7XJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1643529986682/UiLBsNEo-.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--rZ3-z7XJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1643529986682/UiLBsNEo-.png" alt="x.png" width="880" height="462"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let's understand with an example &lt;br&gt;
suppose a = 5, and b = 7;&lt;br&gt;
In binary &lt;br&gt;
A = 101 // 5 In binary&lt;br&gt;
B = 111 // 7 in binary&lt;br&gt;
Let's calculate A &amp;amp; B&lt;/p&gt;

&lt;p&gt;Starting from right in A we have 1 and in b we have 1 it will return 1. Second place A it's 0 B it's 1 hence 0. Now third and last place it's 1 in A and 1 in B so the result will be 1. Finally, we have our result as 101 which again in decimal would be 5.&lt;/p&gt;

&lt;p&gt;So A &amp;amp; B  will result in 5.&lt;/p&gt;

&lt;p&gt;There are some more bitwise operators but we don't use them usually. These are One's Complement Operator &lt;code&gt;~&lt;/code&gt;,  Binary Left Shift Operator &lt;code&gt;&amp;lt;&amp;lt;&lt;/code&gt; and Binary Right Shift Operator &lt;code&gt;&amp;gt;&amp;gt;&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Sample Code
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#include &amp;lt;stdio.h&amp;gt;
int main()
{
    int a = 5;
    int b = 7;
    int c = a &amp;amp; b;
    printf("%d", c);
    return 0;
}
// Output
5
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Assignment Operators
&lt;/h2&gt;

&lt;p&gt;Simple Assignment Operators is &lt;code&gt;=&lt;/code&gt; which is used to assign values to variables in a programming language. for example. &lt;code&gt;a = 3&lt;/code&gt;. We are assigning value to 3 to variable a. but assignment variable can also be used with &lt;code&gt;Arithmetic&lt;/code&gt; and &lt;code&gt;Bitwise&lt;/code&gt; operators let's look at the example.&lt;/p&gt;

&lt;h3&gt;
  
  
  Sample Code
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#include &amp;lt;stdio.h&amp;gt;
int main()
{
    int a = 5;
    a+=3; // adds number 3 in a then assign result to a.
    printf("a = %d", a);
    return 0;
}
// Outout
a = 8
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Misc Operators
&lt;/h2&gt;

&lt;p&gt;There are also some miscellaneous operators in C. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--qCUxlXpH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1643532133749/o9bJXKjzI.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--qCUxlXpH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1643532133749/o9bJXKjzI.png" alt="Operator (1).png" width="880" height="462"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Sample code
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#include &amp;lt;stdio.h&amp;gt;
int main()
{
    int a = 36;
    int c = 20;
    printf("%d\n", sizeof(a)); // return size of variable a
    printf("%d\n", &amp;amp;a); // return address of a
    int *b = &amp;amp;a; // b is pointer to a memory location
    *b = 7; // changing value of a using pointer
    printf("%d\n", a); // printing new value of a
    int d;
    d = (a&amp;gt;c) ? 100 : 200; // assigning value to d based on condition
    printf("%d\n", c); // getting value of c
    return 0;
}
//Output
4
6422024
7
20
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;These are all the operators we can use in c to write programs. I hope I have cleared all the doubts related to operators in C. If you still have any doubts regarding operators or this article just comment down. And do checkout my youtube channel.&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>programming</category>
      <category>tutorial</category>
      <category>codenewbie</category>
    </item>
    <item>
      <title>Create Simple TextToSpeech Utility App in 5 Minutes
</title>
      <dc:creator>Rishabh Kumar</dc:creator>
      <pubDate>Fri, 28 Jan 2022 06:59:08 +0000</pubDate>
      <link>https://dev.to/codewithrish/create-simple-texttospeech-utility-app-in-5-minutes-2bad</link>
      <guid>https://dev.to/codewithrish/create-simple-texttospeech-utility-app-in-5-minutes-2bad</guid>
      <description>&lt;ul&gt;
&lt;li&gt; Create a project with an empty activity.&lt;/li&gt;
&lt;li&gt; Implement the inbuilt class in your MainActivity &lt;code&gt;TextToSpeech.OnInitListener&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It will look something like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public class MainActivity extends AppCompatActivity implements TextToSpeech.OnInitListener 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt; Create cover design with following code paste below code in &lt;code&gt;activity_main&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;?xml version="1.0" encoding="utf-8"?&amp;gt;
&amp;lt;androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity"&amp;gt;

    &amp;lt;TextView
        android:id="@+id/txt_label"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginStart="16dp"
        android:layout_marginTop="16dp"
        android:layout_marginEnd="16dp"
        android:text="@string/text_to_speech"
        android:textColor="#000000"
        android:textSize="24sp"
        android:textStyle="bold"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent" /&amp;gt;

    &amp;lt;EditText
        android:id="@+id/et_input_text"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginStart="16dp"
        android:layout_marginTop="16dp"
        android:layout_marginEnd="16dp"
        android:background="@drawable/rectangle"
        android:ems="10"
        android:hint="@string/enter_some_text"
        android:inputType="textPersonName"
        android:padding="8dp"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="0.497"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/txt_label" /&amp;gt;

    &amp;lt;Button
        android:id="@+id/btn_speak_text"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginStart="16dp"
        android:layout_marginTop="16dp"
        android:layout_marginEnd="16dp"
        android:text="@string/speak_now"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/et_input_text" /&amp;gt;
&amp;lt;/androidx.constraintlayout.widget.ConstraintLayout&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt; Now add the following resources to remove errors in activity_main&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;strings.xml&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    &amp;lt;string name="app_name"&amp;gt;CodeWithRish&amp;lt;/string&amp;gt;
    &amp;lt;string name="text_to_speech"&amp;gt;Text To Speech&amp;lt;/string&amp;gt;
    &amp;lt;string name="enter_some_text"&amp;gt;Enter Some Text ......&amp;lt;/string&amp;gt;
    &amp;lt;string name="speak_now"&amp;gt;Speak Now&amp;lt;/string&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt; Create file &lt;code&gt;rectangle.xml&lt;/code&gt; in drawable and paste below code
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;?xml version="1.0" encoding="UTF-8"?&amp;gt;
&amp;lt;shape xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/listview_background_shape"&amp;gt;
    &amp;lt;stroke android:width="2dp" android:color="#03A9F4" /&amp;gt;
    &amp;lt;padding android:left="2dp"
        android:top="2dp"
        android:right="2dp"
        android:bottom="2dp" /&amp;gt;
    &amp;lt;corners android:radius="5dp" /&amp;gt;
    &amp;lt;solid android:color="#ffffffff" /&amp;gt;
&amp;lt;/shape&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt; Open &lt;code&gt;MainActivity.java&lt;/code&gt; and replace your code with this
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.speech.tts.TextToSpeech;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

import java.util.Locale;

public class MainActivity extends AppCompatActivity implements TextToSpeech.OnInitListener {

    private TextToSpeech textToSpeech;
    private EditText etInputText;
    private Button btnSpeakText;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        init();

        btnSpeakText.setOnClickListener(click -&amp;gt; {
            speakText();
        });
    }

    private void speakText() {
        String input = etInputText.getText().toString();
        textToSpeech.speak(input, TextToSpeech.QUEUE_FLUSH, null);
    }

    private void init() {
        textToSpeech = new TextToSpeech(this, this);
        etInputText = findViewById(R.id.et_input_text);
        btnSpeakText =  findViewById(R.id.btn_speak_text);
    }

    @Override
    public void onInit(int state) {
        if (state == TextToSpeech.SUCCESS) {
            int result = textToSpeech.setLanguage(Locale.UK);

            if (result == TextToSpeech.LANG_MISSING_DATA || result == TextToSpeech.LANG_NOT_SUPPORTED) {
                Toast.makeText(this, "Language Not Supported", Toast.LENGTH_SHORT).show();
            } else {
                Toast.makeText(this, "Enter Text", Toast.LENGTH_SHORT).show();
            }
        }
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now if you want the same color you can replace you &lt;code&gt;colorPrimary&lt;/code&gt; and &lt;code&gt;colorPrimaryVariant&lt;/code&gt;&lt;br&gt;
color with &lt;code&gt;#FFEB3B&lt;/code&gt; color code.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Data Types and Variables in C</title>
      <dc:creator>Rishabh Kumar</dc:creator>
      <pubDate>Thu, 27 Jan 2022 10:05:34 +0000</pubDate>
      <link>https://dev.to/codewithrish/data-types-and-variables-in-c-26ck</link>
      <guid>https://dev.to/codewithrish/data-types-and-variables-in-c-26ck</guid>
      <description>&lt;h1&gt;
  
  
  Variable
&lt;/h1&gt;

&lt;p&gt;A &lt;strong&gt;variable&lt;/strong&gt; is an alias for the memory location. We can store and change its data any number of times. &lt;/p&gt;

&lt;h2&gt;
  
  
  Syntax
&lt;/h2&gt;

&lt;p&gt;type (variables separated by comma); &lt;/p&gt;

&lt;p&gt;Example&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;int a,b,c;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Initialisation
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;a = 5;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;we can also initialise variables while declaration&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;int a = 5, b = 10;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Rules for defining alias or variable
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Allowed character, alphabets, digits and underscore(_)&lt;/li&gt;
&lt;li&gt;Cannot start with a number&lt;/li&gt;
&lt;li&gt;Can't use reserved keywords or whitespaces&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Valid Examples
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;int rish;
int rish123;
int rish_567;
int _rish_code
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Invalid Examples
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;int @hey;
int 5rish;
int int;
int rish code;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Types of variables
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Local Variable (Declared inside block)
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#include &amp;lt;stdio.h&amp;gt;
int main()
{
    int a = 10; //local variable
    return 0;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Global Variable (Declared outside block)
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#include &amp;lt;stdio.h&amp;gt;
int y = 20; // global variable
int main()
{
    int a = 10; //local variable
    return 0;
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Static Variable (Retains it's value between multiple function calls)
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#include &amp;lt;stdio.h&amp;gt;
void function1();
int y = 20; // global variable
int main()
{
    int a = 10; //local variable
    function1();
    function1();
    function1();
    function1();
    function1();
    function1();
    return 0;
}
void function1()
{
    int x = 10;        //local variable
    static int y = 10; //static variable
    x = x + 1;
    y = y + 1;
    printf("\n%d,%d", x, y);
}

// output 
PS C:\Users\risha\Desktop\c&amp;gt; gcc .\hello.c
PS C:\Users\risha\Desktop\c&amp;gt; .\a.exe

11,11
11,12
11,13
11,14
11,15
11,16
PS C:\Users\risha\Desktop\c&amp;gt; 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Automatic Variable (all variables are automatic variable. Explicit declare ex &lt;code&gt;auto int y = 20&lt;/code&gt;)
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#include &amp;lt;stdio.h&amp;gt;
int main()
{
    int x = 10;      //local variable (also automatic)
    auto int y = 20; //automatic variable
    return 0;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  External Variable (can be used in other file)
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#include &amp;lt;stdio.h&amp;gt;
extern int x = 10; //external variable (also global)
int main()
{
    return 0;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Data Types
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;Primary data type: int, char, float, double&lt;/li&gt;
&lt;li&gt;Derived Data Type: array, pointer, structure, union&lt;/li&gt;
&lt;li&gt;Enumeration data type: enum&lt;/li&gt;
&lt;li&gt;Void Data Type: void&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--aJvUcc4I--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1643123291697/zwAw5c5m3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--aJvUcc4I--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1643123291697/zwAw5c5m3.png" alt="Data Type.png" width="880" height="1564"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Sample Code
&lt;/h1&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#include &amp;lt;stdio.h&amp;gt;
int main()
{
    int a = 1;
    char b = 'C';
    double c = 7.77;
    // print variable explain comments
    printf("%d\n", a);
    printf("%c\n", b);
    printf("%.2lf\n", c);
    return 0;
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>codenewbie</category>
      <category>career</category>
      <category>computerscience</category>
      <category>codequality</category>
    </item>
    <item>
      <title>Compilation Process of C Program</title>
      <dc:creator>Rishabh Kumar</dc:creator>
      <pubDate>Mon, 24 Jan 2022 07:12:19 +0000</pubDate>
      <link>https://dev.to/codewithrish/compilation-process-of-c-program-3j1f</link>
      <guid>https://dev.to/codewithrish/compilation-process-of-c-program-3j1f</guid>
      <description>&lt;h2&gt;
  
  
  What is a compilation?
&lt;/h2&gt;

&lt;p&gt;The compilation is the process of converting source code into object code. Your c compiler helps to do so. The compilation process is composed of 4 steps.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Preprocessor&lt;/li&gt;
&lt;li&gt;Compiler&lt;/li&gt;
&lt;li&gt;Assembler&lt;/li&gt;
&lt;li&gt;Linker&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--UKm05KW3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1642948325092/DZgAiYc5_.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--UKm05KW3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1642948325092/DZgAiYc5_.png" alt="Source Code.png" width="880" height="495"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Preprocessor
&lt;/h3&gt;

&lt;p&gt;Your source code is passed to the preprocessor, now the preprocessor expands this code. Later this expanded code is passed to the compiler.&lt;/p&gt;

&lt;h3&gt;
  
  
  Compiler
&lt;/h3&gt;

&lt;p&gt;Compiler converts your expanded code to the assembly code.&lt;/p&gt;

&lt;h3&gt;
  
  
  Assembler
&lt;/h3&gt;

&lt;p&gt;Now assembler converts assembly code into the object code.&lt;/p&gt;

&lt;h3&gt;
  
  
  Linker
&lt;/h3&gt;

&lt;p&gt;Every c program use library functions. These library functions are pre-compiled and the object code of these files is stored with &lt;code&gt;.lib&lt;/code&gt; or &lt;code&gt;.a&lt;/code&gt; extension. The linker combines the object code of library files with object code or our program. Linker also helps us to connect functions defined in some other files. After all the processing linker gives us executable file. Executable files are OS dependent e.g &lt;code&gt;.exe&lt;/code&gt; for DOS and &lt;code&gt;.out&lt;/code&gt; for unix based system.&lt;/p&gt;

&lt;h2&gt;
  
  
  Consider this example
&lt;/h2&gt;

&lt;p&gt;Let say we have a code &lt;code&gt;hello.c&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#include &amp;lt;stdio.h&amp;gt;  
int main()  
{  
    printf("Hello from CodeWithRish");  
    return 0;  
}  
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It's flow will be as shown in the diagram.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--XV0wMRH8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1643006043214/szrTgsE13.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--XV0wMRH8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1643006043214/szrTgsE13.png" alt="C Program.png" width="880" height="1564"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Generate all files
&lt;/h2&gt;

&lt;p&gt;Type following commands&lt;br&gt;
&lt;code&gt;gcc -c -save-temps hello.c&lt;/code&gt; will generate &lt;code&gt;hello.i&lt;/code&gt;, &lt;code&gt;hello.o&lt;/code&gt; and &lt;code&gt;hello.s&lt;/code&gt; now type &lt;code&gt;gcc -o hello hello.c&lt;/code&gt; this command will generate &lt;code&gt;hello.exe&lt;/code&gt; finally just type &lt;code&gt;.\hello.exe&lt;/code&gt; will give program out i.e. &lt;code&gt;Hello from CodeWithRish!&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;That's how you a C Program is compiled in background.&lt;/p&gt;

</description>
      <category>programming</category>
      <category>beginners</category>
      <category>tutorial</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Setup up environment for C Programming</title>
      <dc:creator>Rishabh Kumar</dc:creator>
      <pubDate>Sun, 23 Jan 2022 09:39:53 +0000</pubDate>
      <link>https://dev.to/codewithrish/setup-up-environment-for-c-programming-4l75</link>
      <guid>https://dev.to/codewithrish/setup-up-environment-for-c-programming-4l75</guid>
      <description>&lt;h2&gt;
  
  
  Requirements
&lt;/h2&gt;

&lt;p&gt;To run a C Program on your pc you need 2 things.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Text Editor (Notepad, Notepad++, Sublime-Text-Editor)&lt;/li&gt;
&lt;li&gt;C Compiler (Borland Turbo C, Tiny C Compiler, Portable C Compiler, GCC, Clang)  GCC is most famous we will use GCC.&lt;/li&gt;
&lt;li&gt;IDE (Optional but recommended we will use &lt;code&gt;Visual Studio Code&lt;/code&gt;)&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Installing GCC compiler
&lt;/h2&gt;

&lt;p&gt;There are different ways to install GCC compiler.&lt;/p&gt;

&lt;h3&gt;
  
  
  First Method
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Go to the official website of &lt;code&gt;MinGW-w64&lt;/code&gt; &lt;a href="https://www.mingw-w64.org/"&gt;Link&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Click MSYS2 or directly go to &lt;a href="https://www.msys2.org/"&gt;Link&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Download the installer&lt;/li&gt;
&lt;li&gt;Install it with the default option&lt;/li&gt;
&lt;li&gt;It will give you a console now run the following commands
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Update the package database and base packages
`pacman -Syu`
// Run "MSYS2 MSYS" from Start menu. Update the rest of the base packages
`pacman -Su`
// Now MSYS2 is ready for you. You will probably want to install some tools and the mingw-w64 GCC to start compiling
`pacman -S --needed base-devel mingw-w64-x86_64-toolchain`
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Second Method
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Go to the official &lt;a href="https://www.codeblocks.org/"&gt;website&lt;/a&gt; of CodeBlock&lt;/li&gt;
&lt;li&gt;Clicks Downloads or direct &lt;a href="https://www.codeblocks.org/downloads/"&gt;Link&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Now click on Binary releases or direct &lt;a href="https://www.codeblocks.org/downloads/binaries/"&gt;Link&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Download &lt;code&gt;codeblocks-20.03mingw-setup.exe&lt;/code&gt; using FossHUB Link (it's faster)&lt;/li&gt;
&lt;li&gt;Install it with default options.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Now if you open your cmd and type &lt;code&gt;gcc&lt;/code&gt; it will still not be able to find that compiler you need to set the &lt;code&gt;environment variable&lt;/code&gt; in order to access it globally.&lt;/p&gt;

&lt;h2&gt;
  
  
  Setting Environment Variable
&lt;/h2&gt;

&lt;p&gt;Now we will copy the compiler path and set it in out system environment variables. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Default path for first method : &lt;code&gt;C:\msys64\mingw64\bin&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Default path for second method : &lt;code&gt;C:\Program Files\CodeBlocks\MinGW\bin&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Right click on &lt;code&gt;This PC&lt;/code&gt; or &lt;code&gt;My Computer&lt;/code&gt; select &lt;code&gt;properties&lt;/code&gt;. you will get following screen (Windows 11)&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--mB1cqSi---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1642927753540/ZTh9HRd0f.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--mB1cqSi---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1642927753540/ZTh9HRd0f.png" alt="Screenshot 2022-01-23 141811.png" width="880" height="677"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Click &lt;code&gt;advance system settings&lt;/code&gt; on older windows this option will be on left.&lt;/li&gt;
&lt;li&gt;Now click &lt;code&gt;Environment Variables&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--_MP2cL1d--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1642927944355/Tl8Ikjah9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--_MP2cL1d--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1642927944355/Tl8Ikjah9.png" alt="Screenshot 2022-01-23 142036.png" width="619" height="714"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Now in the System variables select path variable and press edit.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--AgPx2M0y--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1642928097856/Trk2hkI-b.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--AgPx2M0y--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1642928097856/Trk2hkI-b.png" alt="Screenshot 2022-01-23 142335.png" width="880" height="964"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Click New and paste you copied path and press ok.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--SuuGGBjB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1642928232714/DFcudUxXK.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--SuuGGBjB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1642928232714/DFcudUxXK.png" alt="Screenshot 2022-01-23 142654.png" width="759" height="831"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Your &lt;code&gt;environment variable&lt;/code&gt; is set now you can run gcc command on your whole PC.&lt;/p&gt;

&lt;h2&gt;
  
  
  Download and Install Visual Studio Code
&lt;/h2&gt;

&lt;p&gt;We will use VS Code instead of simple notepad to write code.  It's better and made to write code easily. Simple go to the official &lt;a href="https://code.visualstudio.com/"&gt;website&lt;/a&gt; and download and install with default options. Just remember to check &lt;code&gt;Open With Code&lt;/code&gt; option while installation it's really helpful.&lt;/p&gt;

&lt;h2&gt;
  
  
  Install some extensions for better experience
&lt;/h2&gt;

&lt;p&gt;Press &lt;code&gt;Ctrl+Shift+X&lt;/code&gt; in VS Code to search for extentions. Install these extensions&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;C/C++ by Microsoft&lt;/li&gt;
&lt;li&gt;Prettier - Code formatter&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Click gear icon on bottom left and select settings. Search for &lt;code&gt;mouse wheel&lt;/code&gt; and tick the checkbox saying &lt;code&gt;Editor: Mouse Wheel Zoom&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--xkxFpucM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1642928908724/Gw7-uG5yV.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--xkxFpucM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1642928908724/Gw7-uG5yV.png" alt="Screenshot 2022-01-23 143817.png" width="880" height="659"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now you are all set for writing your first code in &lt;code&gt;C&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Write and run your first code.
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Create folder on Desktop name is &lt;code&gt;Learning C&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Drag this folder in VS Code&lt;/li&gt;
&lt;li&gt;Create a file named &lt;code&gt;hello.c&lt;/code&gt; and paste code written below
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#include &amp;lt;stdio.h&amp;gt;

int main()
{
    printf("Hello World from CodeWithRish!");
    return 0;
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Click terminal in options and press new terminal.&lt;br&gt;
In terminal write &lt;code&gt;gcc hello.c&lt;/code&gt; it will generate and executable a.exe if everything is setup correctly. Now type &lt;code&gt;.\a.exe&lt;/code&gt; it will give &lt;code&gt;Hello World from CodeWithRish!&lt;/code&gt; this output. &lt;/p&gt;

&lt;p&gt;Hope everything is setup correctly if still there is some problem drop a comment I'll definitely help you.&lt;/p&gt;

</description>
      <category>c</category>
      <category>codenewbie</category>
      <category>beginners</category>
      <category>programming</category>
    </item>
    <item>
      <title>Creating Whatsapp Like Tabs With New ViewPager2 Android</title>
      <dc:creator>Rishabh Kumar</dc:creator>
      <pubDate>Wed, 19 Jan 2022 17:40:33 +0000</pubDate>
      <link>https://dev.to/codewithrish/creating-whatsapp-like-tabs-with-new-viewpager2-android-1id8</link>
      <guid>https://dev.to/codewithrish/creating-whatsapp-like-tabs-with-new-viewpager2-android-1id8</guid>
      <description>&lt;h2&gt;
  
  
  Required dependency
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;dependencies {
    // material library
    implementation 'com.google.android.material:material:1.5.0'
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  ViewPager2 with Tabs &amp;amp; Fragments
&lt;/h2&gt;

&lt;p&gt;To create swipeable views with tabs, we need 2 views &lt;code&gt;TabLayout&lt;/code&gt; and &lt;code&gt;Viewpager2&lt;/code&gt; and 3 &lt;code&gt;Fragments&lt;/code&gt; for this example.&lt;/p&gt;

&lt;h2&gt;
  
  
  Add the following code to the main activity layout
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;activity_main.xml&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:orientation="vertical"&amp;gt;

    &amp;lt;com.google.android.material.tabs.TabLayout
        android:id="@+id/tab_layout"
        android:backgroundTint="@color/colorPrimary"
        app:tabSelectedTextColor="@color/white"
        app:tabTextColor="@color/grey"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" /&amp;gt;

    &amp;lt;androidx.viewpager2.widget.ViewPager2
        android:id="@+id/view_pager2"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1" /&amp;gt;

&amp;lt;/LinearLayout&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Adding 3 fragments
&lt;/h2&gt;

&lt;p&gt;As I told earlier we will add three fragments for this example &lt;code&gt;CALLS&lt;/code&gt;, &lt;code&gt;CHATS&lt;/code&gt; and &lt;code&gt;STATUS&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Let's add those fragments.&lt;/p&gt;

&lt;h3&gt;
  
  
  CALLS
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;fragment_calls.xml&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;?xml version="1.0" encoding="utf-8"?&amp;gt;
&amp;lt;androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"&amp;gt;

    &amp;lt;TextView
        android:id="@+id/textView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="CALLS"
        android:textSize="34sp"
        android:textStyle="bold"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent" /&amp;gt;
&amp;lt;/androidx.constraintlayout.widget.ConstraintLayout&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;CallsFragment&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;

public class CallsFragment extends Fragment {
    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        return inflater.inflate(R.layout.fragment_calls, container, false);
    }
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  CHATS
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;fragment_chats.xml&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;?xml version="1.0" encoding="utf-8"?&amp;gt;
&amp;lt;androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"&amp;gt;

    &amp;lt;TextView
        android:id="@+id/textView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="CHATS"
        android:textSize="34sp"
        android:textStyle="bold"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent" /&amp;gt;
&amp;lt;/androidx.constraintlayout.widget.ConstraintLayout&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;ChatsFragment&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;

public class ChatsFragment extends Fragment {
    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        return inflater.inflate(R.layout.fragment_chats, container, false);
    }
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  STATUS
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;fragment_status.xml&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;?xml version="1.0" encoding="utf-8"?&amp;gt;
&amp;lt;androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"&amp;gt;

    &amp;lt;TextView
        android:id="@+id/textView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="STATUS"
        android:textSize="34sp"
        android:textStyle="bold"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent" /&amp;gt;
&amp;lt;/androidx.constraintlayout.widget.ConstraintLayout&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;StatusFragment&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;

public class StatusFragment extends Fragment {
    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        return inflater.inflate(R.layout.fragment_status, container, false);
    }
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Now update your MainActivity  with the following code
&lt;/h2&gt;

&lt;p&gt;Each line has a comment to describe the code completely&lt;br&gt;
&lt;code&gt;MainActivity.java&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import androidx.viewpager2.adapter.FragmentStateAdapter;
import androidx.viewpager2.widget.ViewPager2;

import android.os.Bundle;

import com.google.android.material.tabs.TabLayout;
import com.google.android.material.tabs.TabLayoutMediator;

public class MainActivity extends AppCompatActivity {

    // Declare variables
    private TabLayout tabLayout;
    private ViewPager2 viewPager2;

    ViewPagerFragmentAdapter adapter;

    // array for tab labels
    private String[] labels = new String[]{"Calls", "Chats", "Status"};

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        // call function to initialize views
        init();

        // bind and set tabLayout to viewPager2 and set labels for every tab
        new TabLayoutMediator(tabLayout, viewPager2, (tab, position) -&amp;gt; {
            tab.setText(labels[position]);
        }).attach();

        // set default position to 1 instead of default 0
        viewPager2.setCurrentItem(1, false);
    }

    private void init() {
        // initialize tabLayout
        tabLayout = findViewById(R.id.tab_layout);
        // initialize viewPager2
        viewPager2 = findViewById(R.id.view_pager2);
        // create adapter instance
        adapter = new ViewPagerFragmentAdapter(this);
        // set adapter to viewPager2
        viewPager2.setAdapter(adapter);

        // remove default elevation of actionbar
        getSupportActionBar().setElevation(0);
    }

    // create adapter to attach fragments to viewpager2 using FragmentStateAdapter
    private class ViewPagerFragmentAdapter extends FragmentStateAdapter {

        public ViewPagerFragmentAdapter(@NonNull FragmentActivity fragmentActivity) {
            super(fragmentActivity);
        }

        // return fragments at every position
        @NonNull
        @Override
        public Fragment createFragment(int position) {
            switch (position) {
                case 0:
                    return new CallsFragment(); // calls fragment
                case 1:
                    return new ChatsFragment(); // chats fragment
                case 2:
                    return new StatusFragment(); // status fragment
            }
            return new ChatsFragment(); //chats fragment
        }

        // return total number of tabs in our case we have 3
        @Override
        public int getItemCount() {
            return labels.length;
        }
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Congratulation you just created WhatsApp like tabs. &lt;/p&gt;

&lt;p&gt;If you are wordering what this color code is it's &lt;code&gt;#075E54&lt;/code&gt;&lt;/p&gt;

</description>
      <category>programming</category>
      <category>tutorial</category>
      <category>beginners</category>
      <category>productivity</category>
    </item>
    <item>
      <title>How to switch activity and pass data using extras.
</title>
      <dc:creator>Rishabh Kumar</dc:creator>
      <pubDate>Tue, 18 Jan 2022 06:53:36 +0000</pubDate>
      <link>https://dev.to/codewithrish/how-to-switch-activity-and-pass-data-using-extras-2fda</link>
      <guid>https://dev.to/codewithrish/how-to-switch-activity-and-pass-data-using-extras-2fda</guid>
      <description>&lt;h2&gt;
  
  
  Create Android Studio Project.
&lt;/h2&gt;

&lt;p&gt;Select empty activity while creating the project. one project is ready you will have an empty &lt;code&gt;MainActivity&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Create Another Activity
&lt;/h2&gt;

&lt;p&gt;Name your newly created activity as &lt;code&gt;HomeActivity&lt;/code&gt;. we have two methods to start new activity one is &lt;code&gt;startActivity()&lt;/code&gt; and other is &lt;code&gt;startActivityForResult()&lt;/code&gt; each have their own use-cases.&lt;/p&gt;

&lt;p&gt;Snippet to use &lt;code&gt;startActivity()&lt;/code&gt; method&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// create intent object with context and class name of other activity
Intent intent = new Intent(this, HomeActivity.class);
// call startActivity method and pass intent
startActivity(intent);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Passing data
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;putExtra()&lt;/code&gt; method of intent required for passing data&lt;/p&gt;

&lt;p&gt;snippet&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// put data in intent
intent.putExtra("username", "codewithrish"); // you can pass any primary data type easily 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Receiving data in HomeActivity
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;getStringExtra()&lt;/code&gt; method helps us to receive string simlirarily &lt;code&gt;getIntExtra()&lt;/code&gt; for receiving integer value so on.&lt;/p&gt;

&lt;h2&gt;
  
  
  Complete Code Step by Step
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Open &lt;code&gt;MainActivity.java&lt;/code&gt; paste code
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.widget.Button;

public class MainActivity.java extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        Button button = findViewById(R.id.btn_open_activity);
        button.setOnClickListener(click -&amp;gt; {
            openHomeActivity();
        });
    }

    private void openHomeActivity() {
        // create intent object with context and class name of other activity
        Intent intent = new Intent(this, HomeActivity.class);

        // put data in intent
        intent.putExtra("username", "codewithrish");

        // call startActivity method and pass intent
        startActivity(intent);
    }

}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Open &lt;code&gt;activity_main.xml&lt;/code&gt; paste code
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;?xml version="1.0" encoding="utf-8"?&amp;gt;
&amp;lt;androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity"&amp;gt;

    &amp;lt;Button
        android:id="@+id/btn_open_activity"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Go To Home Activity"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent" /&amp;gt;

&amp;lt;/androidx.constraintlayout.widget.ConstraintLayout&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Open &lt;code&gt;HomeActivity.java&lt;/code&gt; paste code
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.widget.TextView;

public class HomeActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_home);

        // get intent
        Intent intent = getIntent();
        // retrieve username from intent
        String username = intent.getStringExtra("username");

        // find text with id
        TextView tvUsername = findViewById(R.id.txt_username);
        //set username to that textview
        tvUsername.setText(username);
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Open &lt;code&gt;HomeActivity.java&lt;/code&gt; paste code
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;?xml version="1.0" encoding="utf-8"?&amp;gt;
&amp;lt;androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".HomeActivity"&amp;gt;

    &amp;lt;TextView
        android:id="@+id/txt_username"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent" /&amp;gt;
&amp;lt;/androidx.constraintlayout.widget.ConstraintLayout&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Run code
&lt;/h2&gt;

&lt;p&gt;Just Run Code you just learn how to switch activity and pass data&lt;/p&gt;

</description>
      <category>android</category>
      <category>career</category>
      <category>tutorial</category>
      <category>programming</category>
    </item>
    <item>
      <title>Google Play In-App Review API to grow your app ratings
</title>
      <dc:creator>Rishabh Kumar</dc:creator>
      <pubDate>Tue, 18 Jan 2022 06:50:36 +0000</pubDate>
      <link>https://dev.to/codewithrish/google-play-in-app-review-api-to-grow-your-app-ratings-4hk7</link>
      <guid>https://dev.to/codewithrish/google-play-in-app-review-api-to-grow-your-app-ratings-4hk7</guid>
      <description>&lt;h2&gt;
  
  
  Intro
&lt;/h2&gt;

&lt;p&gt;Once we publish our app in Google PlayStore and it's live for users to download, app reviews and rating is very crucial for your apps to rank and stand out from the competition. We usually put some buttons of popups in apps to redirect users to PlayStore to get ratings and reviews. Now there is a great chance that users won't come back to the app. To overcome this problem google came up with a pretty good solution named &lt;code&gt;In-App Review&lt;/code&gt;. This API helps us to show rating popup in our app itself so, the users don't have to leave your application.&lt;/p&gt;

&lt;h2&gt;
  
  
  Must know before implementation
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;In-App Review API&lt;/code&gt; supports minimum API level 21.&lt;/li&gt;
&lt;li&gt;The API itself decides how often the review popup will be shown. We should now call it very often because there is a limited  &lt;a href="https://developer.android.com/guide/playcore/in-app-review#quotas"&gt;quota&lt;/a&gt;  it won't show after that.&lt;/li&gt;
&lt;li&gt;The review flow is also controlled by API itself. We should not try to alter that. Follow design  &lt;a href="https://developer.android.com/guide/playcore/in-app-review#design-guidelines"&gt;guidelines&lt;/a&gt;  for API&lt;/li&gt;
&lt;li&gt;The review flow doesn’t indicate whether the user has reviewed our app or not, also it doesn’t tell us anything about what the review widget has shown to the user or not.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Let's Integrate &lt;code&gt;In-App Review API&lt;/code&gt;
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Add the following dependencies in your &lt;code&gt;App Level Gradle&lt;/code&gt; file.
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;//  Play core library
implementation 'com.google.android.play:core:1.10.3'

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Open Main Activity
&lt;/h4&gt;

&lt;p&gt;Now we will create an instance of the &lt;code&gt;ReviewManager&lt;/code&gt; interface, which will help us to start our review dialog. After creating an instance we will call the &lt;code&gt;requestReviewFlow()&lt;/code&gt; method which will return an object of &lt;code&gt;ReviewInfo&lt;/code&gt; class on successful completion. Now with the help of the &lt;code&gt;ReviewInfo&lt;/code&gt; class, we gonna call &lt;code&gt;launchReviewFlow()&lt;/code&gt; method. &lt;em&gt;Hurray we just created a complete flow of In-App Review API&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Now let's see how it looks like in real code.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Code Snippet&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import android.os.Bundle;
import androidx.appcompat.app.AppCompatActivity;
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import com.google.android.play.core.review.ReviewInfo;
import com.google.android.play.core.review.ReviewManager;
import com.google.android.play.core.review.ReviewManagerFactory;
import com.google.android.play.core.tasks.Task;

public class MainActivity extends AppCompatActivity {

    private ReviewManager reviewManager;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        // Initialize reviewManager 
        init();
    }

    // Initializing method for reviewManager
    private void init() {
        reviewManager = ReviewManagerFactory.create(this);
        // Initializing button and setting click listener using lambda method
        findViewById(R.id.rateApp).setOnClickListener(rate -&amp;gt; showRateApp());
    }


    // Shows the app rate dialog box using In-App review API
    // The app rating dialog flow might or might not be shown depending on the quota limitation
    public void showRateApp() {
        Task &amp;lt;ReviewInfo&amp;gt; request = reviewManager.requestReviewFlow();
        request.addOnCompleteListener(task -&amp;gt; {
            if (task.isSuccessful()) {
                // Create ReviewInfo object instance
                ReviewInfo reviewInfo = task.getResult();

                // Calling launch method with reviewManager and pass context and reviewInfo as required parameter
                Task &amp;lt;Void&amp;gt; flow = reviewManager.launchReviewFlow(this, reviewInfo);
                flow.addOnCompleteListener(task1 -&amp;gt; {
                    // The flow has finished. The API does not indicate whether the user
                    // reviewed or not, or even whether the review dialog was shown.
                });
            }
        });
    }
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>android</category>
      <category>programming</category>
      <category>productivity</category>
      <category>career</category>
    </item>
    <item>
      <title>Android Components with Examples
</title>
      <dc:creator>Rishabh Kumar</dc:creator>
      <pubDate>Tue, 18 Jan 2022 06:48:53 +0000</pubDate>
      <link>https://dev.to/codewithrish/android-components-with-examples-3gk5</link>
      <guid>https://dev.to/codewithrish/android-components-with-examples-3gk5</guid>
      <description>&lt;h2&gt;
  
  
  What are Components
&lt;/h2&gt;

&lt;p&gt;App components are the essential building blocks of an Android app. Each component is an entry point through which the system or a user can enter your app. Some components depend on others. All the components are coupled together in a file name &lt;code&gt;AndroidMenifest.xml&lt;/code&gt; which tells how they are going to interact with each other.&lt;/p&gt;

&lt;h2&gt;
  
  
  Type of Components
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Activities&lt;/li&gt;
&lt;li&gt;Services&lt;/li&gt;
&lt;li&gt;Broadcast Receivers&lt;/li&gt;
&lt;li&gt;Content Provides&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Detail Explanations
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Activities
&lt;/h3&gt;

&lt;p&gt;Activity is screen what you see and interact with on your phone. For example, when you open WhatsApp you see activity. Now you click on a chat you see another activity. You can create an activity with build-in class &lt;code&gt;Activity&lt;/code&gt; or &lt;code&gt;AppCompatActivity&lt;/code&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Code snippet
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Activity
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public class MainActivity extends Activity {
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;AppCompatActivity
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public class MainActivity extends AppCompatActivity {
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Services
&lt;/h3&gt;

&lt;p&gt;A service is a general-purpose entry point for keeping an app running in the background for running multiple tasks in the background.  It is a component that runs in the background to perform long-running operations or to perform work for remote processes. For example, a service might play music in the background while the user is in a different app, or it might fetch data over the network without blocking user interaction with an activity. You can create your service with built-in class &lt;code&gt;Service&lt;/code&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Code snippet
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public class CustomService extends Service {
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Broadcast Receivers
&lt;/h3&gt;

&lt;p&gt;Broadcast Receivers enables the system to deliver events to the app outside of a regular user flow, allowing the app to respond to system-wide broadcast announcements. For example, you can fire broadcast when you receive a message, you receive a call, you turn on airplane mode.&lt;/p&gt;

&lt;p&gt;There are two kinds of Broadcast Receivers.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Static Broadcast Receivers:&lt;/strong&gt; These types of Receivers are declared in the manifest file and works even if the app is closed.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Dynamic Broadcast Receivers:&lt;/strong&gt; These types of receivers work only if the app is active or minimized.
#### Code snippet
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public class MyReceiver  extends  BroadcastReceiver {
   public void onReceive(context,intent){}
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Content Providers
&lt;/h3&gt;

&lt;p&gt;A content provider manages a shared set of app data that you can store in the file system, in a SQLite database, on the web, or on any other persistent storage location that your app can access. Through the content provider, other apps can query or modify the data if the content provider allows it.&lt;/p&gt;

&lt;h4&gt;
  
  
  Code snippet
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public class MyContentProvider extends  ContentProvider {
   public void onCreate(){}
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>career</category>
      <category>programming</category>
      <category>android</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
