<?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>Forem: 5hfT</title>
    <description>The latest articles on Forem by 5hfT (@mh_shifat).</description>
    <link>https://forem.com/mh_shifat</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%2F293134%2F5f777b82-9e60-4fd8-8a44-8d47a48a270c.jpg</url>
      <title>Forem: 5hfT</title>
      <link>https://forem.com/mh_shifat</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/mh_shifat"/>
    <language>en</language>
    <item>
      <title>I built a VS Code extension to see what Claude Code is actually doing across all my projects</title>
      <dc:creator>5hfT</dc:creator>
      <pubDate>Sun, 15 Mar 2026 17:36:03 +0000</pubDate>
      <link>https://forem.com/mh_shifat/i-built-a-vs-code-extension-to-see-what-claude-code-is-actually-doing-across-all-my-projects-4626</link>
      <guid>https://forem.com/mh_shifat/i-built-a-vs-code-extension-to-see-what-claude-code-is-actually-doing-across-all-my-projects-4626</guid>
      <description>&lt;p&gt;If you use Claude Code heavily across multiple repos, you probably know this feeling.&lt;/p&gt;

&lt;p&gt;You have Claude running in several projects at the same time and at some point you start wondering:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;How much did I spend this week?&lt;/li&gt;
&lt;li&gt;Which project burned the most tokens?&lt;/li&gt;
&lt;li&gt;What was that session from yesterday even about?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I kept hitting this problem, so I built a small tool for it.&lt;/p&gt;

&lt;p&gt;It's a &lt;strong&gt;VS Code extension called Claude Code Dashboard&lt;/strong&gt; that shows everything Claude Code has been doing across your projects in one place.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Main features:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;🗂️ See all Claude Code projects in one sidebar&lt;/li&gt;
&lt;li&gt;📝 Session history per project (shows the first prompt as preview)&lt;/li&gt;
&lt;li&gt;💰 Token and cost breakdown per session and per project&lt;/li&gt;
&lt;li&gt;📁 See which files Claude touched and which tools it used&lt;/li&gt;
&lt;li&gt;⚡ Detects when a Claude session is actively running&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The nice part: &lt;strong&gt;there’s no setup.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;No API keys, no accounts, nothing external.&lt;br&gt;&lt;br&gt;
It just reads the session data Claude Code already stores locally.&lt;/p&gt;

&lt;p&gt;I mainly built it because once you start using Claude Code a lot, you lose visibility pretty quickly.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Available here:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Promo Homepage: &lt;a href="https://claude-code-dashboard-jspw.vercel.app/" rel="noopener noreferrer"&gt;https://claude-code-dashboard-jspw.vercel.app&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;VS Code Marketplace: &lt;a href="https://marketplace.visualstudio.com/items?itemName=jspw.claude-code-dashboard" rel="noopener noreferrer"&gt;https://marketplace.visualstudio.com/items?itemName=jspw.claude-code-dashboard&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Open VSX (Cursor / Windsurf) -&amp;gt; &lt;a href="https://open-vsx.org/extension/jspw/claude-code-dashboard" rel="noopener noreferrer"&gt;https://open-vsx.org/extension/jspw/claude-code-dashboard&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Source Code -&amp;gt; &lt;a href="https://github.com/jspw/Claude-Code-Dashboard" rel="noopener noreferrer"&gt;https://github.com/jspw/Claude-Code-Dashboard&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It's &lt;strong&gt;free and open source (AGPL-3.0)&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;If you're a heavy Claude Code user, I'm curious if this would actually be useful for you or if there are other things you'd want to see in a dashboard like this.&lt;/p&gt;

</description>
      <category>claudecode</category>
      <category>ai</category>
      <category>vscode</category>
      <category>extensions</category>
    </item>
    <item>
      <title>Cool, Fancy &amp; Cutting Edge Shits I have Learnt Recently</title>
      <dc:creator>5hfT</dc:creator>
      <pubDate>Tue, 26 Nov 2024 05:23:05 +0000</pubDate>
      <link>https://forem.com/mh_shifat/cool-fancy-cutting-edge-shits-i-have-learnt-recently-3hg3</link>
      <guid>https://forem.com/mh_shifat/cool-fancy-cutting-edge-shits-i-have-learnt-recently-3hg3</guid>
      <description>&lt;ul&gt;
&lt;li&gt;mixing Legacy MVC (WEB) Framework &amp;amp; Modern Frontend Framework/Library (Springboot MVC X JSP X ReactJs)&lt;/li&gt;
&lt;li&gt;Using Multiple (3) Databases in a single application&lt;/li&gt;
&lt;li&gt;Using Two Mongodb databases in a same application&lt;/li&gt;
&lt;li&gt;Using Multiple (2) Apache ActiveMQs (not multiple Queues obviously) in a single application&lt;/li&gt;
&lt;li&gt;Running multiple instances of a single expressjs/nodejs application with statically defined docker-compose files&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>softwareengineering</category>
    </item>
    <item>
      <title>The Weird Javascript</title>
      <dc:creator>5hfT</dc:creator>
      <pubDate>Thu, 07 Oct 2021 06:09:34 +0000</pubDate>
      <link>https://forem.com/mh_shifat/the-weird-javascript-516h</link>
      <guid>https://forem.com/mh_shifat/the-weird-javascript-516h</guid>
      <description>&lt;p&gt;This is &lt;a href="https://www.github.com/jspw"&gt;Mehedi Hasan Shifat&lt;/a&gt;. I am trying to write about the things I feel &lt;strong&gt;weird&lt;/strong&gt; about javascript (not saying bad :3). i will write something about javascript everyday whenever I get some free time. Mark watch &lt;a href="https://github.com/jspw/The-Weird-Javascript"&gt;The-Weird-Javascript&lt;/a&gt; to get latest update.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt; : This is not a blog/article/repo to learn javascript. you can get some awesome blogs and video playlists about javascript which are really awesome. And feel free to correct me.&lt;/p&gt;

&lt;h1&gt;
  
  
  Table of Contents
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;
Contents

&lt;ul&gt;
&lt;li&gt;
Undefined | Error ?(being written )&lt;/li&gt;
&lt;li&gt;
Betrayal of Switch-Case(to be added)&lt;/li&gt;
&lt;li&gt;
Reference in Javascript(to be added)&lt;/li&gt;
&lt;li&gt;
Type(to be added)&lt;/li&gt;
&lt;/ul&gt;


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

&lt;h2&gt;
  
  
  Contents
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Undefined || Error ?
&lt;/h3&gt;

&lt;p&gt;Let's look at some code snippets.&lt;/p&gt;

&lt;h6&gt;
  
  
  code-01
&lt;/h6&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;num&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;num&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;num&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Guess, what is the output of the code ?&lt;br&gt;
Is it a &lt;code&gt;compilation error&lt;/code&gt; ? just kidding :v&lt;/p&gt;

&lt;p&gt;output :&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;It says &lt;code&gt;undefined&lt;/code&gt;. Okey, let's take another look -&lt;/p&gt;

&lt;h6&gt;
  
  
  code-02
&lt;/h6&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;num&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;num&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;num&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Guess again &lt;code&gt;undefined&lt;/code&gt; ? Shouldn't it be &lt;code&gt;undefined&lt;/code&gt; as the variable &lt;code&gt;num&lt;/code&gt; is declared after the &lt;code&gt;console.log()&lt;/code&gt; ? or the code should break as &lt;code&gt;10&lt;/code&gt; is inserted(? will talk about later) into &lt;code&gt;num&lt;/code&gt; before initializing it ?&lt;/p&gt;

&lt;p&gt;output :&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Great!&lt;/strong&gt; if it matches with your thinking, if doesn't then let's discover the mystery of bermuda triangle :D&lt;/p&gt;

&lt;p&gt;If &lt;strong&gt;javascript&lt;/strong&gt;(hight level language) is your first one &amp;amp; only language then may be you will find it normal* but people like us coming from a low level language like &lt;strong&gt;C&lt;/strong&gt; will find this fucking weird :3&lt;/p&gt;

&lt;p&gt;It's all about &lt;strong&gt;hoisting&lt;/strong&gt;. Javascript actually split the initialization and declaration and moves declarations(like var num) to the top. So actually what / how the code was we can say like this :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;num&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;undefined&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nx"&gt;num&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;num&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So for &lt;code&gt;var&lt;/code&gt; a variable is declared with &lt;code&gt;undefined&lt;/code&gt; at the top, then when the line of declaration comes it assign value to it.&lt;/p&gt;

&lt;p&gt;Then why in the first example it printed &lt;code&gt;undefined&lt;/code&gt; ?&lt;br&gt;
If we look at the code carefully we can see that, at the first code snippet, we print the value of num before store the value when it was undefined.But in the second case it was already initialized.&lt;br&gt;
Actually in the first example the code were executed like this :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;num&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;undefined&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;num&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// so it was undefined when we were logging num&lt;/span&gt;
&lt;span class="nx"&gt;num&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt; : This is not the actual scenario but something like this was happened. And one thing more about the words &lt;code&gt;insert&lt;/code&gt; and &lt;code&gt;initialize&lt;/code&gt; value to a variable , we will talk about it later.&lt;/p&gt;

&lt;p&gt;For that reason we can call a function in js before initializing it like this -&lt;/p&gt;

&lt;h6&gt;
  
  
  code-03
&lt;/h6&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nf"&gt;printSum&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;printSum&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;n&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// print sum of 1 to n&lt;/span&gt;
  &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;n&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;n&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let's find some corner cases how can we declare (?) or initialize variables in js.&lt;/p&gt;

&lt;h6&gt;
  
  
  code-04
&lt;/h6&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;num&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;num&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now i have just removed &lt;code&gt;var&lt;/code&gt; from the previous code (code-02). will it run properly ? Is it undefined for hoisting ? or &lt;code&gt;Reference error&lt;/code&gt; ?&lt;/p&gt;

&lt;p&gt;output :&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;As there is no &lt;code&gt;var num&lt;/code&gt; in our code there is no hoisting. It just initialized x. This could be a different scenario if we were using &lt;code&gt;strict&lt;/code&gt; mode. Strict mode is a feature of ES5. It applies some restrictions.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;use strict&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nx"&gt;num&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;num&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this case we will get &lt;code&gt;ReferenceError: num is not defined&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;You can also set strict mode for individual functions too.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;note&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;The whole script is not in strict mode now&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;strictMode&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;use strict&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="c1"&gt;// do your stuffs&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We have learnt about hoisting. Javascript has now a few more declaration keys like the weird &lt;code&gt;var&lt;/code&gt; , they are &lt;code&gt;let&lt;/code&gt;, &lt;code&gt;const&lt;/code&gt;. Why the hack we need let or const as we already have var ? We have enough weirdness in js, why adding some more?&lt;/p&gt;

&lt;p&gt;Wait, think positive. May be it can save us from the devil var :3&lt;/p&gt;

&lt;p&gt;Before going to &lt;code&gt;let&lt;/code&gt; &amp;amp; &lt;code&gt;const&lt;/code&gt;, let's observe some weirdness of &lt;code&gt;var&lt;/code&gt; and why &lt;code&gt;var&lt;/code&gt; is the devil :3&lt;/p&gt;

&lt;h6&gt;
  
  
  code-05
&lt;/h6&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;x&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;x&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;hello&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;x&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;x&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;What the hack is this ? I have initialized x with 10 which is a number , then again with "hello" string and at last with a boolean true. Is the program runnable ? &lt;code&gt;error&lt;/code&gt; &lt;code&gt;error&lt;/code&gt; &lt;code&gt;error&lt;/code&gt; ? &lt;code&gt;reference&lt;/code&gt; error ?&lt;/p&gt;

&lt;p&gt;Let's see the output :&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;For hoisting, &lt;code&gt;x&lt;/code&gt; was declared at the top before execution and then it was initialized with 10,"hello" and true accordingly.As at the last before logging it was a boolean, it printed &lt;code&gt;true&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;var&lt;/code&gt; actually declares a function-scoped or globally-scoped variable. There are some interesting facts here. Using&lt;code&gt;var&lt;/code&gt; for declaration javascript moves the declaration at the top of the function(*) actually. Let's see the code -&lt;/p&gt;

&lt;h6&gt;
  
  
  code-06
&lt;/h6&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;foo&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;x&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;x&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;50&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;x&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;51&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;x&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;x&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nf"&gt;foo&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;output :&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;Inside the function its always the same &lt;code&gt;x&lt;/code&gt;.&lt;/p&gt;

&lt;h6&gt;
  
  
  code-07
&lt;/h6&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;goo&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;x&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;foo&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;x&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="nf"&gt;foo&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
  &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;x&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="nf"&gt;goo&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Can you guess the output this time ? &lt;code&gt;20&lt;/code&gt; haa ??&lt;/p&gt;

&lt;p&gt;Output :&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;Shouldn't surprise as I have told before that &lt;code&gt;var&lt;/code&gt; declares a function scoped variable so &lt;code&gt;x&lt;/code&gt; inside &lt;code&gt;foo&lt;/code&gt; is hoisted at the top of the &lt;code&gt;foo&lt;/code&gt; function not globally. That's why global &lt;code&gt;x&lt;/code&gt; and &lt;code&gt;x&lt;/code&gt; inside &lt;code&gt;foo&lt;/code&gt; is not same.Let's see another example -&lt;/p&gt;

&lt;h6&gt;
  
  
  code-08
&lt;/h6&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;x&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;foo&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;y&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="nf"&gt;foo&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;y&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Output :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;ReferenceError&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;y&lt;/span&gt; &lt;span class="nx"&gt;is&lt;/span&gt; &lt;span class="nx"&gt;not&lt;/span&gt; &lt;span class="nx"&gt;defined&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;YES! Successfully created a &lt;code&gt;reference error&lt;/code&gt; again :3&lt;/p&gt;

&lt;p&gt;You can't access a variable out of its scope, and thats actually gooood!&lt;/p&gt;

&lt;p&gt;here is a nested functional scope example of var -&lt;/p&gt;

&lt;h6&gt;
  
  
  code-09
&lt;/h6&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;google&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;foo&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;y&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;bar&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;p&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;12&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;value of y : &lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;y&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// will print 10&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="nf"&gt;bar&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;value of p : &lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;p&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// reference error for p&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="nf"&gt;foo&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="nf"&gt;google&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Actually when we declare a variable it is available everywhere in the scope as well as any lower/child/inner scopes.&lt;/p&gt;

&lt;p&gt;Beside that, as we can see declaring variables with &lt;code&gt;var&lt;/code&gt; is risky. There is a very good possibility of using the same name of two different variables for different task and it can produce a bug which will be difficult to find out and fix it.&lt;/p&gt;

&lt;p&gt;To solve this problem, they introduced &lt;code&gt;let&lt;/code&gt;. &lt;code&gt;const&lt;/code&gt; is the constant form of &lt;code&gt;let&lt;/code&gt; actually.&lt;/p&gt;

&lt;p&gt;In mathematics we used to say, &lt;code&gt;let x .....&lt;/code&gt;. Most languages like &lt;strong&gt;Scheme&lt;/strong&gt; adopt let from mathematical statement. If you have done some study on &lt;code&gt;how js was created or how&lt;/code&gt;, it will be more clear to understand. btw &lt;strong&gt;Scheme&lt;/strong&gt; has also &lt;code&gt;let*&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Let's rewrite some of the previously written code snippets with &lt;code&gt;let&lt;/code&gt;.&lt;/p&gt;

&lt;h6&gt;
  
  
  code-10
&lt;/h6&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;num&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;num&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Output :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ReferenceError: Cannot access 'num' before initialization
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h6&gt;
  
  
  code-11
&lt;/h6&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;x&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="c1"&gt;// .......&lt;/span&gt;
&lt;span class="c1"&gt;// .......&lt;/span&gt;
&lt;span class="c1"&gt;// .......&lt;/span&gt;
&lt;span class="c1"&gt;// .......&lt;/span&gt;
&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;x&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;shifat&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// SyntaxError: Identifier 'x' has already been declared&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h6&gt;
  
  
  code-12
&lt;/h6&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;num&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;num&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1000&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// num is a new variable here ,not the global one&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;num&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;output :&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;let&lt;/code&gt; declares block-scoped which is limited to the scop of the block.The variable is said to be in a "temporal dead zone" (TDZ) from the start of the block until the initialization has completed. The variables are not accessible until fully initialization. &lt;code&gt;let&lt;/code&gt; saves us a lot. Most of the weird stuffs of &lt;code&gt;var&lt;/code&gt; is covered with &lt;code&gt;let&lt;/code&gt; . So its safer to use &lt;code&gt;let&lt;/code&gt; then &lt;code&gt;var&lt;/code&gt;.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Very Beginner Level Version Controlling With Git</title>
      <dc:creator>5hfT</dc:creator>
      <pubDate>Sun, 03 Oct 2021 03:12:59 +0000</pubDate>
      <link>https://forem.com/mh_shifat/very-beginner-level-version-controlling-with-git-27pj</link>
      <guid>https://forem.com/mh_shifat/very-beginner-level-version-controlling-with-git-27pj</guid>
      <description>&lt;h3&gt;
  
  
  Basic commands
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;init repository : &lt;code&gt;git init&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;add a file : &lt;code&gt;git add filename&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;add all files : &lt;code&gt;git add .&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;commit : &lt;code&gt;git commit -m "commit message"&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;check status which files you have added/deleted/modified : &lt;code&gt;git status&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;push code : &lt;code&gt;git push origin branch_name&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Full Examples
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Create a new repository
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Create a repository : Create an empty repository in &lt;a href="https://github.com/"&gt;github&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Then open git bash/terminal in your local pc&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;init project : &lt;code&gt;git init&lt;/code&gt; (initializing our repository)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For example, let's add something into our repo. Let's add a file named README.md. You can create a file using your GUI(Graphical User Interface). In FileManager, right click on mouse and file or folder creation options will be popped up. Or you can use your shell/bash terminal to create the file.&lt;/p&gt;

&lt;p&gt;As i'm a linux user and taking flex in front of you, I will create the file using my oh-my-zsh(a bash terminal).&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;create a file in bash : &lt;code&gt;touch README.md&lt;/code&gt; (this will create a empty file named README.md in the directory you are in now, you can check current directory using &lt;code&gt;pwd&lt;/code&gt; in terminal). You can add some content in it.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now we have created a file and we want to add it into our repository. It does exist in our local pc not in github server yet[check if you don't believe me :)].&lt;br&gt;
To upload it we need to follow some stuffs -&amp;gt; ['add','commit','push'].Let's do it.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Add the file in git : &lt;code&gt;git add README.md&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you are curious enough and lazy :D then you must be thinking of 'adding 100 files/folder will fuck our hand and mind!'. Actually we can add all files or files with same extension or file starting or ending with same substring and so on!&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Add all files in the current dir : &lt;code&gt;git add .&lt;/code&gt; (a dot can save your life :3)&lt;/li&gt;
&lt;li&gt;Commit changes : &lt;code&gt;git commit -m "short but meaningful commit message" -m "description can be added but its optional"&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;According to my previous statement, we need to push the commit but there is a small thing we need to do as we want to connect our local repo with e github server repository we have created at first. So we need to make a link/connection for the first time. Before that we will change/move/rename the branch name. If your are in a terminal you may be notice that the default branch is master now.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7wvnk86lbls0omskr4ke.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7wvnk86lbls0omskr4ke.png" alt="bash-master" width="652" height="73"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the screenshot you can see some colorful text.Forgot about the first text &lt;code&gt;(base)&lt;/code&gt; its a different stuff to describe (not related to git). After (base) next things are &lt;code&gt;username@pc_name&amp;gt;working_directory&amp;gt;git_branch_name&lt;/code&gt; accordingly.&lt;br&gt;
We here my branch name is &lt;code&gt;master&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;We will change the default branch name to &lt;code&gt;main&lt;/code&gt; according to github's preference.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;rename branch : &lt;code&gt;git branch -M main&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Let me describe what we have done here. We just have changed the branch name from master to main. We could have used &lt;code&gt;git branch -m main&lt;/code&gt; but there is a little differences between &lt;code&gt;-m&lt;/code&gt; and &lt;code&gt;-M&lt;/code&gt;. Actually &lt;code&gt;-m&lt;/code&gt; define the changing but there can be a scenario where the branch name &lt;code&gt;main&lt;/code&gt; already exist where we had to force git to change branch name. &lt;code&gt;-f&lt;/code&gt; or &lt;code&gt;--force&lt;/code&gt; is used to do something forcefully. &lt;code&gt;-M&lt;/code&gt; is actually a short form of &lt;code&gt;-m -f&lt;/code&gt; here. We will learn a lot about branch command later.&lt;/p&gt;

&lt;p&gt;Now we need to link our local repo with github server somehow !&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;git remote add origin https://github.com/your_username/github_repository_name&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;by this command we are creating a origin / we are adding a location of our remote repository where we will push our file or pull files from.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;push code to github : &lt;code&gt;git push origin main&lt;/code&gt; (as our branch name is main)&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Working on a repository
&lt;/h4&gt;

&lt;p&gt;Scenario is we have a repository and we want to contribute in that open source project.&lt;/p&gt;

&lt;p&gt;Link of the repository : &lt;a href="https://github.com/jspw/git-101"&gt;git-101&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;First of all we need to clone the repository : &lt;code&gt;git clone https://github.com/jspw/git-101.git&lt;/code&gt; (this will create a folder named git-101 and copy the repository)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If we wish to copy the repo into a folder as our wish, then we can just add the folder name at the end of the command like this &lt;code&gt;git clone repo_url dir_name&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Now we have cloned the repo and we can add changes as our wish (not exactly your wish though :3).&lt;/p&gt;

&lt;p&gt;Lets assume we have added a file named contributor.md and other files as well. Now we need to add the files or directories.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;add all files : &lt;code&gt;git add .&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;commit changes : &lt;code&gt;git commit -m 'add contributor file'&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;push code : &lt;code&gt;git push origin main&lt;/code&gt; (this is a very beginner level tutorial, actually we never push code into main directly, we will lean this things later)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Note :&lt;/strong&gt; I will write intermediate level git commands and uses later. &lt;br&gt;
Follow &lt;a href="https://github.com/jspw/git-101"&gt;git-101&lt;/a&gt; to get update.&lt;/p&gt;

</description>
      <category>github</category>
      <category>git</category>
      <category>beginners</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>My First Python Package, an Auto Generator for Solved Problems in Codeforces</title>
      <dc:creator>5hfT</dc:creator>
      <pubDate>Thu, 14 Jan 2021 14:29:15 +0000</pubDate>
      <link>https://forem.com/mh_shifat/my-first-python-package-an-auto-generator-for-solved-problems-in-codeforces-4edd</link>
      <guid>https://forem.com/mh_shifat/my-first-python-package-an-auto-generator-for-solved-problems-in-codeforces-4edd</guid>
      <description>&lt;p&gt;I have made an python package named &lt;strong&gt;&lt;a href="https://pypi.org/project/cp-tool/"&gt;cp-tool&lt;/a&gt;&lt;/strong&gt; and published in &lt;a href="https://pypi.org/"&gt;https://pypi.org&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--QfKFeRDb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://img.shields.io/badge/version-2.1.1-blue" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--QfKFeRDb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://img.shields.io/badge/version-2.1.1-blue" alt="" width="90" height="20"&gt;&lt;/a&gt; &lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--aYQsxa9M--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://img.shields.io/badge/license-MIT-brightgreen" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--aYQsxa9M--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://img.shields.io/badge/license-MIT-brightgreen" alt="" width="78" height="20"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;cp-tool&lt;/strong&gt; is an auto generator for solved problems at different online judges. It gathers all the problems you have solved at an online judge and generates a git repository for you.&lt;/p&gt;

&lt;p&gt;Generated &lt;a href="https://github.com/jspw/cp-tool-sample"&gt;Sample Git Rep&lt;/a&gt; by &lt;a href="https://github.com/jspw/cp-tool"&gt;cp-tool&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Supported Platforms
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://codeforces.com"&gt;Codeforces&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Requirments
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;python &amp;gt;=3.6&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Instruction
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;h3&gt;
  
  
  Installation
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Linux :&lt;/li&gt;
&lt;/ul&gt;


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

&lt;blockquote&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pip install cp-tool
&lt;/code&gt;&lt;/pre&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;Windows :&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;python -m pip install cp-tool
&lt;/code&gt;&lt;/pre&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;Note : Please updated version&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;h3&gt;
  
  
  Upgrade :
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Linux :&lt;/li&gt;
&lt;/ul&gt;


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

&lt;blockquote&gt;
&lt;p&gt;pip install --upgrade cp-tool&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;Windows :&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;python -m pip install --upgrade cp-tool&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;h3&gt;
  
  
  Usage
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Using command &lt;code&gt;cp-tool&lt;/code&gt; it will show the usages&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fhu6au7bfw4f44mwemoca.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fhu6au7bfw4f44mwemoca.png" alt="" width="652" height="273"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Init with git repo :&lt;/li&gt;
&lt;li&gt;Create a git repository first&lt;/li&gt;
&lt;li&gt;Then init&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cp-tool -c init -j codeforces
&lt;/code&gt;&lt;/pre&gt;
&lt;/blockquote&gt;

&lt;p&gt;You will be asked for&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;handle&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;example : &lt;code&gt;shifat57&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;

&lt;p&gt;repository name (A folder will be created based in repo name)&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;example : &lt;code&gt;My Cp Track&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;

&lt;p&gt;repository url&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;example : &lt;code&gt;https://github.com/jspw/cp-tool-sample&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;


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

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fs7ja0xgwrft0r5oq4k51.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fs7ja0xgwrft0r5oq4k51.png" alt="" width="727" height="512"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Update submissions :&lt;/li&gt;
&lt;li&gt;Go to the repository folder in your local file&lt;/li&gt;
&lt;li&gt;Then&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;cp-tool -c update -j codeforces&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fzl4k70i4cqm6ovcweh6w.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fzl4k70i4cqm6ovcweh6w.png" alt="" width="670" height="696"&gt;&lt;/a&gt;&lt;/p&gt;


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

&lt;h2&gt;
  
  
  License
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://dev.toLICENSE"&gt;MIT&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/jspw/cp-tool"&gt;Check Source Code&lt;/a&gt;&lt;br&gt;
&lt;a href="https://github.com/jspw/cp-tool-sample"&gt;Sample Repo generated by cp-tool&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Make Your Own Custom Android Launcher using Flutter</title>
      <dc:creator>5hfT</dc:creator>
      <pubDate>Wed, 23 Sep 2020 09:30:48 +0000</pubDate>
      <link>https://forem.com/mh_shifat/make-your-own-custom-android-launcher-using-flutter-558j</link>
      <guid>https://forem.com/mh_shifat/make-your-own-custom-android-launcher-using-flutter-558j</guid>
      <description>&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F0gv5rs2m1c0qetbl56gx.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F0gv5rs2m1c0qetbl56gx.gif" alt="Ubuntu Launcher"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h6&gt;
  
  
  Have you ever thought of making your own stuffs and use them?
&lt;/h6&gt;

&lt;p&gt;Like your Own&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Operation System !&lt;/li&gt;
&lt;li&gt;Programming Language !&lt;/li&gt;
&lt;li&gt;Library !&lt;/li&gt;
&lt;li&gt;Framework !&lt;/li&gt;
&lt;li&gt;Apps !&lt;/li&gt;
&lt;li&gt;Games !&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I'm that kind of person who was always interested in making applications which are &lt;strong&gt;integrated&lt;/strong&gt; to the system (literally Applications) not business or commercial applications and still i am :3&lt;/p&gt;

&lt;p&gt;I have always dreamt about things of my own...&lt;/p&gt;

&lt;p&gt;So once I thought to make my own &lt;strong&gt;Android Launcher&lt;/strong&gt; as I'm using Android Phones.&lt;/p&gt;

&lt;p&gt;At first I thought it's something very hard and I won't be able to make a launcher.Then I found it supper easy!&lt;/p&gt;

&lt;h2&gt;
  
  
  Today i am going to discuss about how to nake your Android Launcher !
&lt;/h2&gt;

&lt;p&gt;Let's start!&lt;/p&gt;

&lt;p&gt;I am using &lt;strong&gt;Flutter&lt;/strong&gt; which is a &lt;strong&gt;Cross Platform Framework&lt;/strong&gt; of &lt;strong&gt;Dart&lt;/strong&gt; Made by &lt;strong&gt;Google&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;There is a big community of &lt;strong&gt;Flutter&lt;/strong&gt; to make &lt;strong&gt;cross&lt;/strong&gt; platform applications such as &lt;strong&gt;Android&lt;/strong&gt;,&lt;strong&gt;IOS&lt;/strong&gt;,&lt;strong&gt;Desktop&lt;/strong&gt; and &lt;strong&gt;Web applications&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;If you haven't installed flutter yet then have a look at their doc which is very user friendly and well decorated.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://flutter.dev/docs/get-started/install?gclid=CjwKCAjwwab7BRBAEiwAapqpTF1KuSOnthNqucXzsGFZK0QM5L9xw4C_bkR_zzK3GJhAsFd2K49RDxoC22QQAvD_BwE&amp;amp;gclsrc=aw.ds" rel="noopener noreferrer"&gt;Install Flutter&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note :&lt;/strong&gt; I am using &lt;strong&gt;Visual Studio Code&lt;/strong&gt; as a Editor or IDE and prefer &lt;strong&gt;terminal&lt;/strong&gt; and command line activities.&lt;/p&gt;

&lt;h3&gt;
  
  
  Lets create a flutter application
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Command in terminal :&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;flutter create -i objc -a java custom_launcher&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;Note :&lt;/strong&gt; This command will create a application named &lt;code&gt;custom_launcher&lt;/code&gt; and the &lt;strong&gt;native&lt;/strong&gt; code for &lt;strong&gt;Android&lt;/strong&gt; will be &lt;strong&gt;java&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If you prefer &lt;strong&gt;Kotlin&lt;/strong&gt; then just use -&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;flutter create custom_launcher&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h6&gt;
  
  
  A flutter app will be created with similler file Structure:
&lt;/h6&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F800%2F1%2A8KDHRxRAuGLvrvpp1UVAuQ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F800%2F1%2A8KDHRxRAuGLvrvpp1UVAuQ.png" alt="files"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We will code in &lt;code&gt;main.dart&lt;/code&gt; file.&lt;/p&gt;

&lt;p&gt;First We will need to edit some codes in the &lt;code&gt;AndroidManifest.xml&lt;/code&gt; file. That will make our &lt;strong&gt;launcher&lt;/strong&gt; different from &lt;strong&gt;normal Android Applications&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Manifest file location :&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F800%2F1%2AFK9wa8Ek_spB0hZSGMckjA.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F800%2F1%2AFK9wa8Ek_spB0hZSGMckjA.png" alt="xml"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Add these lines in &lt;code&gt;AndroidManifest.xml&lt;/code&gt; file under &lt;code&gt;&amp;lt;intent-filter&amp;gt;&lt;/code&gt; section :&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight xml"&gt;&lt;code&gt;

&lt;span class="nt"&gt;&amp;lt;category&lt;/span&gt; &lt;span class="na"&gt;android:name=&lt;/span&gt;&lt;span class="s"&gt;"android.intent.category.HOME"&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;category&lt;/span&gt; &lt;span class="na"&gt;android:name=&lt;/span&gt;&lt;span class="s"&gt;"android.intent.category.DEFAULT"&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;



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

&lt;/div&gt;

&lt;p&gt;Now If you &lt;strong&gt;run&lt;/strong&gt; your app , it will appear as a &lt;strong&gt;Launcher&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Or &lt;strong&gt;Press Home button&lt;/strong&gt; of your android phone and it will ask to set it as &lt;strong&gt;default&lt;/strong&gt; launcher.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F800%2F1%2A_1VULV0nBwyQSwK4fi5GLQ.png" alt="launcher"&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h5&gt;
  
  
  Congrats You have made your launcher :D
&lt;/h5&gt;

&lt;p&gt;Yup Seriously ! It is that easy !&lt;/p&gt;

&lt;p&gt;Now as a Flutter Application &lt;strong&gt;developer&lt;/strong&gt; I hope you are able to do some of your own customizations.&lt;/p&gt;

&lt;p&gt;I know you are concert about how can you show the &lt;strong&gt;installed applications&lt;/strong&gt; in your custom Launcher.&lt;/p&gt;

&lt;p&gt;Let's do it:&lt;/p&gt;

&lt;h3&gt;
  
  
  Interact with the Applications installed in Phone
&lt;/h3&gt;

&lt;p&gt;To do so we will use a flutter plugin named &lt;strong&gt;&lt;code&gt;device_apps&lt;/code&gt;&lt;/strong&gt; which will give us a &lt;code&gt;List&amp;lt;application&amp;gt;&lt;/code&gt; where all the necessary informations will be given.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt; First import &lt;code&gt;device_apps&lt;/code&gt; into your dart file :&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight dart"&gt;&lt;code&gt;

&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="s"&gt;'package:device_apps/device_apps.dart'&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;


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

&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt; Get the list of apps available in your phone :&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight dart"&gt;&lt;code&gt;


&lt;span class="kt"&gt;List&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;Application&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;apps&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;DeviceApps&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;getInstalledApplications&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;



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

&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;You can send some parameters too :&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight dart"&gt;&lt;code&gt;


&lt;span class="kt"&gt;List&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;Application&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;apps&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;DeviceApps&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;getInstalledApplications&lt;/span&gt;
&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="nl"&gt;includeAppIcons:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;includeSystemApps:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;onlyAppsWithLaunchIntent:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;



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

&lt;/div&gt;

&lt;p&gt;This will return something like that :&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F800%2F1%2AlwWFeWLXJNDNw9Wytr6EyQ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F800%2F1%2AlwWFeWLXJNDNw9Wytr6EyQ.png" alt="20data"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h5&gt;
  
  
  It provides :
&lt;/h5&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;App Name (String)
Apk File Path (String)
Package Name (String)
Version Name (String)
Version Code (int)
System App ? (bool)
Install Time (int)
Update Time (int)
Application Catagory (Catagory Type)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;It also provides &lt;code&gt;icon&lt;/code&gt; as &lt;code&gt;ApplicationIcon&lt;/code&gt;.&lt;br&gt;
To access icon you have to use that &lt;code&gt;Application&lt;/code&gt; type as &lt;code&gt;ApplicationWithIcon&lt;/code&gt; and check that the &lt;strong&gt;app has a icon&lt;/strong&gt; first.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note :&lt;/strong&gt; &lt;strong&gt;icon&lt;/strong&gt; is a &lt;strong&gt;Uint8 List&lt;/strong&gt; type.&lt;/p&gt;

&lt;p&gt;Now You have your data so do what ever you want !&lt;/p&gt;

&lt;h3&gt;
  
  
  Let me show you how you can use them
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt; Let's traverse all the apps we get before :&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight dart"&gt;&lt;code&gt;


&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;apps&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;length&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
    &lt;span class="n"&gt;Application&lt;/span&gt; &lt;span class="n"&gt;app&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;apps&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;



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

&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;Extract the application name :&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight dart"&gt;&lt;code&gt;


&lt;span class="n"&gt;Text&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;app&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;appName&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;



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

&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;Use Icon :&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight dart"&gt;&lt;code&gt;


&lt;span class="n"&gt;app&lt;/span&gt; &lt;span class="k"&gt;is&lt;/span&gt; &lt;span class="n"&gt;ApplicationWithIcon&lt;/span&gt; &lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="n"&gt;CircleAvatar&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
 &lt;span class="nl"&gt;backgroundImage:&lt;/span&gt;
     &lt;span class="n"&gt;MemoryImage&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
   &lt;span class="n"&gt;app&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;icon&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
 &lt;span class="p"&gt;),&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;



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

&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Note :&lt;/strong&gt; If you are not able to access app.icon then use this -&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight dart"&gt;&lt;code&gt;


&lt;span class="n"&gt;ApplicationWithIcon&lt;/span&gt; &lt;span class="n"&gt;icon&lt;/span&gt; &lt;span class="n"&gt;app&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;ApplicationWithIcon&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;icon&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;icon&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;icon&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;


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

&lt;/div&gt;
&lt;h3&gt;
  
  
  More things you will want to do :
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Check if an application is installed :&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight dart"&gt;&lt;code&gt;


&lt;span class="kt"&gt;bool&lt;/span&gt; &lt;span class="n"&gt;isInstalled&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;DeviceApps&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;isAppInstalled&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;'packageName'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;



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

&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;Open an Application :&lt;/li&gt;
&lt;/ul&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight dart"&gt;&lt;code&gt;

&lt;p&gt;&lt;span class="n"&gt;DeviceApps&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;openApp&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;'packageName'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;&lt;/p&gt;

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

&lt;/div&gt;
&lt;h6&gt;
&lt;br&gt;
  &lt;br&gt;
  &lt;br&gt;
  Apps can be shown like this :&lt;br&gt;
&lt;/h6&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F800%2F1%2ABxoraA9qXR13AG8lM6vr-g.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F800%2F1%2ABxoraA9qXR13AG8lM6vr-g.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I have made an Android Launcher which is lightweight and Fast.You can have a look and If you like then give me a star :v&lt;/p&gt;

&lt;p&gt;Source Code available : &lt;a href="https://github.com/jspw/Ubuntu-Launcher" rel="noopener noreferrer"&gt;Ubuntu Launcher&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Apk Release : &lt;a href="https://github.com/jspw/Ubuntu-Launcher/releases/tag/2.0.0" rel="noopener noreferrer"&gt;Install&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Happy Coding :D&lt;/p&gt;

&lt;p&gt;Contact with | Follow me on : &lt;a href="https://www.linkedin.com/in/mehedi-hasan-shifat-2b10a4172/" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt; &lt;a href="https://twitter.com/mhshifat757" rel="noopener noreferrer"&gt;Twitter&lt;/a&gt; &lt;a href="https://www.facebook.com/rio57mh/" rel="noopener noreferrer"&gt;Facebook&lt;/a&gt; &lt;a href="https://github.com/jspw" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt; &lt;a href="https://www.quora.com/profile/Mehedi-Hasan-Shifat" rel="noopener noreferrer"&gt;Quora&lt;/a&gt; &lt;a href="https://dev.to/mh_shifat"&gt;Dev&lt;/a&gt; &lt;a href="https://medium.com/@mhshifat757" rel="noopener noreferrer"&gt;Medium&lt;/a&gt;&lt;/p&gt;

</description>
      <category>android</category>
      <category>ios</category>
      <category>showdev</category>
      <category>vscode</category>
    </item>
    <item>
      <title>Host Your Django Project in pythonanywhere Free</title>
      <dc:creator>5hfT</dc:creator>
      <pubDate>Wed, 12 Aug 2020 20:07:09 +0000</pubDate>
      <link>https://forem.com/mh_shifat/host-your-django-project-in-pythonanywhere-free-3m4f</link>
      <guid>https://forem.com/mh_shifat/host-your-django-project-in-pythonanywhere-free-3m4f</guid>
      <description>&lt;p&gt;&lt;strong&gt;PythonAnywhere&lt;/strong&gt; is an online integrated development environment and web hosting service based on the Python programming language.&lt;br&gt;
You can host your pet projects here which is free.&lt;/p&gt;

&lt;h3&gt;
  
  
  Let's start :
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Go to &lt;a href="http://pythonanywhere.com"&gt;PythonAnywhere&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Create account and login&lt;/li&gt;
&lt;li&gt;Go to consoles&lt;/li&gt;
&lt;li&gt;Select bash console&lt;/li&gt;
&lt;li&gt;Create virtual environment for python
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mkvirtualenv --python=python3.8 envname
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Your environment will be activated and in bash you will see the envname in parenthesis&lt;/li&gt;
&lt;li&gt;Install django
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pip install -U django==3.0.3
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;check django path
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;which django-admin.py
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;install necessary packages
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pip instal xyz
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Clone git repo
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git clone repo.git
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Note :&lt;/strong&gt; You should have a git repo of the project or web application&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Go to dashboard of pythonanywhere.com and go to Web&lt;/li&gt;
&lt;li&gt;Select create new web app

&lt;ul&gt;
&lt;li&gt;next&lt;/li&gt;
&lt;li&gt;select manual configuration&lt;/li&gt;
&lt;li&gt;next next done !&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;Here you will see the url for your project click and you will see hello world page which is default for python
&lt;h4&gt;
  
  
  Config WebApp :&lt;/h4&gt;
&lt;/li&gt;



&lt;li&gt;
&lt;code&gt;setvirtualenv&lt;/code&gt; path which you will find in console using
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;which django-admin.py
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;set &lt;code&gt;source code&lt;/code&gt; as &lt;code&gt;/home/username/projectname&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;static files&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;set &lt;code&gt;/static/admin/&lt;/code&gt; as    &lt;code&gt;/home/username/.virtualenvs/blog/lib/python3.8/site-packages/django/contrib/admin/static/admin&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;set &lt;code&gt;/static/&lt;/code&gt; as your project static folder path as mine is &lt;code&gt;/home/jspw/shifat.com/blog/static&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;&lt;p&gt;set &lt;code&gt;Virtualenv&lt;/code&gt; dir as &lt;code&gt;/home/username/.virtualenvs/env_name&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Edit WSGI configuration file as the file given below&lt;br&gt;&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;sys&lt;/span&gt;
&lt;span class="c1"&gt;## assuming your django settings file is at '/home/jspw/mysite/mysite/settings.py'
## and your manage.py is is at '/home/jspw/mysite/manage.py'
&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;/home/jspw/mysite&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;  &lt;span class="c1"&gt;#path of your project
&lt;/span&gt;&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;path&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;sys&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;sys&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;chdir&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;environ&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setdefault&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;DJANGO_SETTINGS_MODULE&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;food_menu_project.settings&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;  &lt;span class="c1"&gt;#projectname.settings
&lt;/span&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;django&lt;/span&gt;

&lt;span class="n"&gt;django&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setup&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;django.core.wsgi&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;get_wsgi_application&lt;/span&gt;
&lt;span class="n"&gt;application&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;get_wsgi_application&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Done ! Clik on the reload in the webapp page then go to the website url  and boom!!!&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Note :&lt;/strong&gt; Check settings.py file and you have allowed your host url.&lt;/p&gt;

</description>
      <category>django</category>
      <category>python</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Pointer in C/C++</title>
      <dc:creator>5hfT</dc:creator>
      <pubDate>Fri, 17 Jul 2020 07:01:05 +0000</pubDate>
      <link>https://forem.com/mh_shifat/pointer-in-c-c-7el</link>
      <guid>https://forem.com/mh_shifat/pointer-in-c-c-7el</guid>
      <description>&lt;h1&gt;
  
  
  Pointer in C/C++
&lt;/h1&gt;

&lt;p&gt;Let's consider a int type variable &lt;strong&gt;var&lt;/strong&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;var&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So if we print &lt;strong&gt;var&lt;/strong&gt; it will be like :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="n"&gt;printf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"%d"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;var&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Output : &lt;code&gt;10&lt;/code&gt;&lt;br&gt;
There is a location in our system memory where every variables are stored when we declare them.&lt;br&gt;
So where is the variable &lt;strong&gt;var&lt;/strong&gt; ?&lt;br&gt;
To print the momory address or location of a variable we have to use &lt;strong&gt;unary &amp;amp;&lt;/strong&gt; operator&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="n"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"The memory address of a is %p: "&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;//%p is used to print a pointer&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Output :&lt;code&gt;The memory address of a is : 0x7fffbabdb6f0&lt;/code&gt;&lt;br&gt;
The memory address can be different as it takes a random memory address everytime you build your program, but looks like same(&lt;strong&gt;0x..........&lt;/strong&gt;).&lt;br&gt;
Let's declare a pointer :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;pa&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// or int * pa&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Note : If you are pointing the pointer at a data type you have to declare it at the declaration of the pointer&lt;/strong&gt;&lt;br&gt;
Now point Pointer &lt;strong&gt;pa&lt;/strong&gt; at &lt;strong&gt;var&lt;/strong&gt;;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="n"&gt;pa&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;var&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now the pointer is pointed at the &lt;strong&gt;var&lt;/strong&gt; variable and it takes the location or memory address of &lt;strong&gt;var&lt;/strong&gt;.&lt;br&gt;
Let's print &lt;strong&gt;pa&lt;/strong&gt; :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="n"&gt;printf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"%p"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;pa&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Output : &lt;code&gt;0x7fffbabdb6f0&lt;/code&gt;&lt;br&gt;
Which is same as the memory address of &lt;strong&gt;var&lt;/strong&gt; variable.&lt;br&gt;
We can also print the value of a memory address using &lt;strong&gt;unary *&lt;/strong&gt; operator.This is also called &lt;strong&gt;dereferencing&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="n"&gt;printf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"%d"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;pa&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Output : &lt;code&gt;10&lt;/code&gt;&lt;br&gt;
Now we can say a &lt;strong&gt;Pointer&lt;/strong&gt; is an object in many programming languages that stores a memory address.&lt;br&gt;
Let's see what happens if we change the value of &lt;strong&gt;var&lt;/strong&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="n"&gt;var&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;10001&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;printf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Value of var : %d&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;var&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="n"&gt;printf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Value of memory  address %p is : %d"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;pa&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;pa&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Output :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Value of var : 10001
Value of Memory address 0x7fffbabdb6f0 is : 10001
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We can see changing the value of &lt;strong&gt;var&lt;/strong&gt; changes the value of &lt;strong&gt;pa&lt;/strong&gt; memory address.&lt;br&gt;
What if we increase the value of the Pointer &lt;strong&gt;pa&lt;/strong&gt; ? Let's see:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="n"&gt;pa&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;printf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Pointer (pa) is pointed to %p and value becomes : %d&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;pa&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;pa&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Output :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Pointer (pa) is pointed to 0x7fffbabdb6f8 and value becomes : -1161971980
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here &lt;strong&gt;-1161971980&lt;/strong&gt; is a gurbage value as nothing is initialized in memory address &lt;strong&gt;0x7fffbabdb6f8&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Pointer Expressions and Pointer Arithmetic:
&lt;/h3&gt;

&lt;p&gt;A limited set of arithmetic operations can be performed on pointers. A pointer may be:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;incremented ( ++ )&lt;/li&gt;
&lt;li&gt;decremented ( -- )&lt;/li&gt;
&lt;li&gt;an integer may be added to a pointer ( + or += )&lt;/li&gt;
&lt;li&gt;an integer may be subtracted from a pointer ( – or -= )&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Pointer arithmetic is meaningless unless performed on an array.&lt;br&gt;
&lt;strong&gt;Note : Pointers contain addresses. Adding two addresses makes no sense, because there is no idea what it would point to. Subtracting two addresses lets you compute the offset between these two addresses.&lt;/strong&gt;&lt;/p&gt;
&lt;h4&gt;
  
  
  Pointer in Arrays
&lt;/h4&gt;

&lt;p&gt;Declare an array:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;ar&lt;/span&gt;&lt;span class="p"&gt;[]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Declare pointer variable:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;ptr&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Assign the address of v[0] to ptr&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="n"&gt;ptr&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;ar&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;//We can use ptr=&amp;amp;ar[0];(both are same)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let's print array elements with thieir memory address :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;printf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Value of *ptr = %d&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;ptr&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="n"&gt;printf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Value of ptr = %p&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;ptr&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

    &lt;span class="c1"&gt;// Increment pointer ptr by 1&lt;/span&gt;
    &lt;span class="n"&gt;ptr&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Output :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Value of *ptr = 1
Value of ptr = 0x7fffe4378a30
Value of *ptr = 2
Value of ptr = 0x7fffe4378a34
Value of *ptr = 3
Value of ptr = 0x7fffe4378a38
Value of *ptr = 4
Value of ptr = 0x7fffe4378a3c
Value of *ptr = 5
Value of ptr = 0x7fffe4378a40
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We can also use :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;cout&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;ptr&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class="s"&gt;" "&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="n"&gt;cout&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;endl&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Output : &lt;code&gt;1 2 3 4 5&lt;/code&gt;&lt;br&gt;
As an array name acts like a pointer constant. The value of this pointer constant is the address of the first element.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pointer to pointer&lt;/strong&gt;&lt;br&gt;
Have you even think that if a variable has a memory address in the memory then what about the pointer we are using to point on the variable?&lt;br&gt;
Yes,a pointer also has a memory address.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;sum&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;psum&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;printf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Memory address of variable(sum) : %p&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;psum&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="n"&gt;printf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Memory Address of pointer(psum) :  %p&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;psum&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Output :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Memory address of variable(sum) : 0x7ffc3b46638c
Memory Address of pointer(psum) :  0x7ffc3b466398
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let's declare a pointer for a int pointer :3&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="o"&gt;**&lt;/span&gt;&lt;span class="n"&gt;ppsum&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;psum&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;//as ppsum is a pointer of a int type variable's pointer&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;print the memory address of the pointer :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="n"&gt;printf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Memory Address of pointer(psum) :  %p&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;ppsum&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Output :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Memory Address of pointer(psum) :  0x7ffc712e6780
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Pointer in Structure
&lt;/h3&gt;

&lt;p&gt;Structures are user defined data types.&lt;/p&gt;

&lt;p&gt;Let' see a structure&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="k"&gt;struct&lt;/span&gt; &lt;span class="nc"&gt;Person&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;            &lt;span class="c1"&gt;//structure&lt;/span&gt;
    &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;age&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;//members&lt;/span&gt;
    &lt;span class="kt"&gt;float&lt;/span&gt; &lt;span class="n"&gt;salary&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the Person structure there are two member int type and float type.Person is also a data type here.&lt;/p&gt;

&lt;p&gt;So the Person data type also invoke memory and has a memory address.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="k"&gt;struct&lt;/span&gt; &lt;span class="nc"&gt;Person&lt;/span&gt; &lt;span class="n"&gt;p1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="n"&gt;printf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"%p"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;p1&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Output:&lt;br&gt;
&lt;br&gt;
 &lt;code&gt;0x7ffebf9ffab0&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;Let's declare a pointer and point to the structure.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="k"&gt;struct&lt;/span&gt; &lt;span class="nc"&gt;Person&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="o"&gt;=&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;p1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;printf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"%p"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

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

&lt;/div&gt;



&lt;p&gt;Output:&lt;br&gt;
&lt;br&gt;
 &lt;code&gt;0x7ffebf9ffab0&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;We can also use pointer  to change values:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;age&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;25&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;//or *(p).age = 25&lt;/span&gt;
&lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;salary&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;2121324.50&lt;/span&gt;

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

&lt;/div&gt;



&lt;h3&gt;
  
  
  Pass by Value
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;passByValue&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
    &lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="n"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"In passByValue function, x = %d&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;(){&lt;/span&gt;
    &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="n"&gt;passByValue&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="n"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"In main Function, x = : %d&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Output :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;In passByValue function, x = 20
In main Function, x = : 10
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this case, &lt;code&gt;x&lt;/code&gt; in passByValue() function and &lt;code&gt;x&lt;/code&gt; in main() function are not same, just the variable names are same but they indicate two different memory locations.&lt;br&gt;
Let's go deeper :3&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;passByValue&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
    &lt;span class="n"&gt;cout&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class="s"&gt;"In passByValue Function : "&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;endl&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="n"&gt;printf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"x = %d&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="n"&gt;cout&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class="s"&gt;"Memory address of x = "&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&amp;lt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;endl&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;(){&lt;/span&gt;
    &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="n"&gt;passByValue&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="n"&gt;cout&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class="s"&gt;"In main Function : "&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;endl&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="n"&gt;printf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"x = %d&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="n"&gt;cout&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class="s"&gt;"Memory address of x = "&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&amp;lt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;endl&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Output :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;In passByValue Function :
x = 20
Memory address of x = 0x7ffc6c07397c
In main Function :
x = 10
Memory address of x = 0x7ffc6c0739a0
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So looking at the outputs we can find that the memory addresses are not same ! The two &lt;code&gt;x&lt;/code&gt; are not same.&lt;/p&gt;

&lt;h3&gt;
  
  
  Pass by Reference
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;passByReference&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;px&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
    &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;px&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="n"&gt;printf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"In passByReference() function, Memory address =  %p&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;px&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;(){&lt;/span&gt;
    &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="n"&gt;cout&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class="s"&gt;"(Before) Value of x : "&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;endl&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="n"&gt;passByReference&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="n"&gt;cout&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class="s"&gt;"(After) Value of x : "&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;endl&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="n"&gt;cout&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class="s"&gt;"Memory address of x = "&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&amp;lt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;endl&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

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

&lt;/div&gt;



&lt;p&gt;Output :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;(Before) Value of x : 10
Memory address =  0x7ffe2bd44670
(After) Value of x : 100
Memory address of x = 0x7ffe2bd44670
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In pass by reference we are sending the memory address of &lt;code&gt;x&lt;/code&gt; and then in the function we are chnaging the value which is stored in the memory address.&lt;br&gt;
So chaging value of memory address will also chnage the value of &lt;code&gt;a&lt;/code&gt; as it is stored in the memory address.&lt;/p&gt;
&lt;h3&gt;
  
  
  Dangling Pointers
&lt;/h3&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nf"&gt;getValue&lt;/span&gt;&lt;span class="p"&gt;(){&lt;/span&gt;
    &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;(){&lt;/span&gt;
    &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;px&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;getValue&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
    &lt;span class="n"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Value in memory address(px) = %d&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;px&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

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

&lt;/div&gt;


&lt;p&gt;Output : &lt;code&gt;Value in memory address(px) = 2&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;In this case getValue() returns the memory address where &lt;code&gt;x&lt;/code&gt; were stored. After returning memory address &lt;code&gt;x&lt;/code&gt; vanishes but the value in that address remains and after that if we take a variable like&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;var3&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;120&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;there is a huge possibility that &lt;code&gt;var3&lt;/code&gt; can be stored in that memory address which can make problem for you and that is called &lt;strong&gt;Dangling Pointer&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Dangling pointers&lt;/strong&gt; arise during object destruction, when an object that has an incoming reference is deleted or deallocated, without modifying the value of the pointer, so that the pointer still points to the memory location of the deallocated memory.&lt;/p&gt;

&lt;p&gt;So hare comes the term &lt;strong&gt;Dynamic Memory Allocation&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Dynamic Memory Allocation
&lt;/h3&gt;

&lt;p&gt;Sections in Memory management:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Stack&lt;/li&gt;
&lt;li&gt;Heap&lt;/li&gt;
&lt;li&gt;BSS&lt;/li&gt;
&lt;li&gt;Data&lt;/li&gt;
&lt;li&gt;Code&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;C Dynamic Memory Allocation can be defined as a procedure in which the size of a data structure (like Array) is changed during the runtime.&lt;/p&gt;

&lt;p&gt;There are 4 library functions provided by C defined under  header file to facilitate dynamic memory allocation in C programming. They are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;malloc()&lt;/li&gt;
&lt;li&gt;calloc()&lt;/li&gt;
&lt;li&gt;free()&lt;/li&gt;
&lt;li&gt;realloc()&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  C malloc() method
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;“malloc”&lt;/strong&gt; or &lt;strong&gt;“memory allocation”&lt;/strong&gt; method in C is used to dynamically allocate a single large block of memory with the specified size. It returns a pointer of type void which can be cast into a pointer of any form. It initializes each block with default garbage value.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Syntax:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;ptr = (cast-type*) malloc(byte-size)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;For Example:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;ptr&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;malloc&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;100&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nf"&gt;sizeof&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Since the size of int is 4 bytes, this statement will allocate 400 bytes of memory. And, the pointer ptr holds the address of the first byte in the allocated memory.&lt;/p&gt;

&lt;h4&gt;
  
  
  C free() method
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;“free”&lt;/strong&gt; method in C is used to dynamically de-allocate the memory. The memory allocated using functions malloc() and calloc() is not de-allocated on their own. Hence the free() method is used, whenever the dynamic memory allocation takes place. It helps to reduce wastage of memory by freeing it.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="n"&gt;free&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ptr&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Note:When we declare a pointer it pointed to a random memory address of the memory so better practice is to set them null first&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;px&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  C calloc() method
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;“calloc”&lt;/strong&gt; or &lt;strong&gt;“contiguous allocation”&lt;/strong&gt; method in C is used to dynamically allocate the specified number of blocks of memory of the specified type. It initializes each block with a default value ‘0’.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Syntax:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;ptr = (cast-type*)calloc(n, element-size);&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;For Example:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="n"&gt;ptr&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;float&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;calloc&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;25&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;sizeof&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;float&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This statement allocates contiguous space in memory for 25 elements each with the size of the float.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note:alloc() function allocate n bytes in memory where calloc() function allocate x blocks of y bytes in memory&lt;/strong&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  C realloc() method
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;“realloc”&lt;/strong&gt; or &lt;strong&gt;“re-allocation”&lt;/strong&gt; method in C is used to dynamically change the memory allocation of a previously allocated memory.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Syntax:&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;ptr = realloc(ptr, newSize);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;where ptr is reallocated with new size 'newSize'.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;p&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="n"&gt;malloc&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;n&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="nf"&gt;sizeof&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;span class="n"&gt;p&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;realloc&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;n&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="nf"&gt;sizeof&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;for more &lt;a href="https://www.design-reuse.com/articles/25090/dynamic-memory-allocation-fragmentation-c.html"&gt;Dynamic Memory Allocation and Fragmentation in C and C++&lt;/a&gt;&lt;/p&gt;

</description>
      <category>c</category>
      <category>cpp</category>
      <category>pointer</category>
      <category>progamming</category>
    </item>
    <item>
      <title>How To create Alarm and Notification in Android using Flutter?</title>
      <dc:creator>5hfT</dc:creator>
      <pubDate>Fri, 10 Jul 2020 09:31:14 +0000</pubDate>
      <link>https://forem.com/mh_shifat/how-to-create-alarm-and-notification-in-android-using-flutter-7ci</link>
      <guid>https://forem.com/mh_shifat/how-to-create-alarm-and-notification-in-android-using-flutter-7ci</guid>
      <description>&lt;p&gt;I am making an Android application and need to make set alarm option and  set that the app will give notifications at a fixed time or something.I'm using Flutter. How can i do that? &lt;/p&gt;

</description>
      <category>dart</category>
      <category>android</category>
      <category>flutter</category>
    </item>
    <item>
      <title>A OS Cleaner for Debian Based Linux distributions !</title>
      <dc:creator>5hfT</dc:creator>
      <pubDate>Wed, 17 Jun 2020 17:03:58 +0000</pubDate>
      <link>https://forem.com/mh_shifat/a-os-cleaner-for-debian-based-linux-distributions-4j8j</link>
      <guid>https://forem.com/mh_shifat/a-os-cleaner-for-debian-based-linux-distributions-4j8j</guid>
      <description>&lt;p&gt;I have written a python script that will show and delete the unnecessary caches and files from a operating system (debian based ).&lt;/p&gt;

&lt;h3&gt;
  
  
  This sript will clear the :
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;packages that are no longer required&lt;/li&gt;
&lt;li&gt;Clean up APT cache&lt;/li&gt;
&lt;li&gt;systemd journal logs (more than 7 days)&lt;/li&gt;
&lt;li&gt;Clean the thumbnail cache&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Most of the time these files takes a lot of storage !&lt;br&gt;
and using a bunch of commands to remove them are quit boring .&lt;br&gt;
So i have gathered the commands  and added them in a python script.&lt;br&gt;
&lt;a href="https://github.com/jspw/Cleaner"&gt;Here is my git repo have a look&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;Usages :&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Clone repo :&lt;code&gt;git clone https://github.com/jspw/Cleaner.git&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Chnage directory : &lt;code&gt;cd Cleaner&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Check the caches : &lt;code&gt;sudo python cleaner.py -s&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Clear the caches : &lt;code&gt;sudo python cleaner.py -c&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;feel free to suggest any option or command to add or report  any error in the script .&lt;br&gt;
&lt;strong&gt;Thanks&lt;/strong&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Live Input Output (Competitive Programming) setup in VS CODE for C/C++ (WINDOWS)</title>
      <dc:creator>5hfT</dc:creator>
      <pubDate>Fri, 22 May 2020 17:44:14 +0000</pubDate>
      <link>https://forem.com/mh_shifat/live-input-output-competitive-programming-setup-in-vs-code-for-c-c-windows-4opp</link>
      <guid>https://forem.com/mh_shifat/live-input-output-competitive-programming-setup-in-vs-code-for-c-c-windows-4opp</guid>
      <description>&lt;h2&gt;
  
  
  How to install and setup vs code for competitive programming with c/c++ for Windows Users
&lt;/h2&gt;

&lt;h3&gt;
  
  
  install  vs code
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Download vs code : &lt;a href="https://%C2%ADcode.visualstudio.com" rel="noopener noreferrer"&gt;Link&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Install in your pc&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Setup environment for c/c++
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;install mingw : &lt;a href="https://osdn.net/projects/mingw/downloads/68260/mingw-get-setup.exe/" rel="noopener noreferrer"&gt;link&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;In you pc search for &lt;strong&gt;system environment&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fgithub.com%2Fjspw%2FVS-Code-Config%2Fraw%2Fmaster%2Fimages%2Fsearch%2520system%2520enbironment.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fgithub.com%2Fjspw%2FVS-Code-Config%2Fraw%2Fmaster%2Fimages%2Fsearch%2520system%2520enbironment.png" alt="search system enbironment"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;go to &lt;strong&gt;Environment variables&lt;/strong&gt; &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fgithub.com%2Fjspw%2FVS-Code-Config%2Fraw%2Fmaster%2Fimages%2Fenvironment%2520variable.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fgithub.com%2Fjspw%2FVS-Code-Config%2Fraw%2Fmaster%2Fimages%2Fenvironment%2520variable.png" alt="Environment variables"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Go to &lt;strong&gt;system varibale&lt;/strong&gt; and &lt;strong&gt;click on path&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fgithub.com%2Fjspw%2FVS-Code-Config%2Fraw%2Fmaster%2Fimages%2Fpath%2520edit%2520and%2520add%2520new.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fgithub.com%2Fjspw%2FVS-Code-Config%2Fraw%2Fmaster%2Fimages%2Fpath%2520edit%2520and%2520add%2520new.png" alt="system varibale"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;click edit&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;select new &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;paste the link where you mingw bin folder . for me it is &lt;code&gt;C:\MinGW\bin&lt;/code&gt; &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;find it there&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;&lt;p&gt;select ok ok for everything&lt;/p&gt;&lt;/li&gt;

&lt;/ul&gt;

&lt;h3&gt;
  
  
  Install git
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;download link &lt;a href="https://git-scm.com/download/win" rel="noopener noreferrer"&gt;Link&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Then &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Open Vs code&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Open your coding folder &lt;code&gt;file-&amp;gt;open folder&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;press &lt;code&gt;ctrl+~&lt;/code&gt; and the terminal will be opened at the bottom&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fgithub.com%2Fjspw%2FVS-Code-Config%2Fraw%2Fmaster%2Fimages%2Fvs%2520code%2520terminal.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fgithub.com%2Fjspw%2FVS-Code-Config%2Fraw%2Fmaster%2Fimages%2Fvs%2520code%2520terminal.png" alt="terminal"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;if in the terminal u find that its &lt;strong&gt;cmd&lt;/strong&gt; or &lt;strong&gt;powershell&lt;/strong&gt; then click  on &lt;strong&gt;cmd/powershell&lt;/strong&gt; and select '&lt;code&gt;set default sell&lt;/code&gt;' and select &lt;code&gt;git&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;ul&gt;
&lt;li&gt;Now click on the delete icon and  press &lt;code&gt;ctrl+~&lt;/code&gt; and its saying your shell is bash!&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;if still bash no showing then close vs code and open vs code again&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fgithub.com%2Fjspw%2FVS-Code-Config%2Fraw%2Fmaster%2Fimages%2Fvs%2520code%2520terminal.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fgithub.com%2Fjspw%2FVS-Code-Config%2Fraw%2Fmaster%2Fimages%2Fvs%2520code%2520terminal.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Run a programme for testing :
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;create a file hello.cpp&lt;/li&gt;
&lt;li&gt;write code to print hello&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;in terminal use the command &lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;g++ hello.cpp -o test &amp;amp;&amp;amp; ./test
&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If you find &lt;code&gt;hello&lt;/code&gt; then congrats&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;if saying g++ not found then try to close vs code and then oepn vs code again.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Setup Vs Code
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Clik on terminal (At the top)&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fgithub.com%2Fjspw%2FVS-Code-Config%2Fraw%2Fmaster%2Fimages%2Ftop_bar.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fgithub.com%2Fjspw%2FVS-Code-Config%2Fraw%2Fmaster%2Fimages%2Ftop_bar.png" alt="Top bar"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;select configure task&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;select create task.json from template &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;select other and new task.json file will be created&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;now copy and paste the my &lt;code&gt;task(windows).json&lt;/code&gt; {&lt;a href="https://github.com/jspw/VS-Code-Config/blob/master/Config-Files/C%26C%2B%2B/Windows/tasks.json" rel="noopener noreferrer"&gt;link is here&lt;/a&gt;}   file into your &lt;code&gt;task.json&lt;/code&gt; file&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;done&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;More things to do :&lt;br&gt;
Note : &lt;strong&gt;You just need to do these things only for the first time of your workspace!&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Split screen in 3 sections 
&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fgithub.com%2Fjspw%2FVS-Code-Config%2Fraw%2Fmaster%2Fimages%2Fsplit%2520options.png" alt="Split Screen"&gt;

&lt;ul&gt;
&lt;li&gt;split the main section in right (right mouse click on the .cpp file and u will get the split options)&lt;/li&gt;
&lt;li&gt;then split the right into down (same as above)&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;create a file named &lt;code&gt;input.txt&lt;/code&gt;
&lt;/li&gt;

&lt;li&gt;create a file named &lt;code&gt;output.txt&lt;/code&gt;
&lt;/li&gt;

&lt;li&gt;open input.txt into the upper right section&lt;/li&gt;

&lt;li&gt;open output.txt into the lower right section&lt;/li&gt;

&lt;/ul&gt;

&lt;h4&gt;
  
  
  This will be the final look of your vs code
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F5now5k1orkmc6nhwq83w.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F5now5k1orkmc6nhwq83w.png" alt="Final Look"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Now create a folder and create your file .cpp inside the folder and give inputs in input.txt and press &lt;code&gt;Ctrl+Shift+b&lt;/code&gt; and your output will be in the output.txt file
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Note :&lt;/strong&gt; &lt;strong&gt;Don't keep the cpp file in the base folder&lt;/strong&gt;. I mean you have to &lt;strong&gt;create one or more folders&lt;/strong&gt; in the &lt;strong&gt;base folder&lt;/strong&gt; (Base folder means &lt;strong&gt;where you opened your vs code&lt;/strong&gt; or you can say &lt;strong&gt;vs code wrokspace&lt;/strong&gt; folder).and the input and output file should be in the base folder.&lt;/p&gt;

&lt;h5&gt;
  
  
  Folders should be like this or similer :
&lt;/h5&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fgithub.com%2Fjspw%2FVS-Code-Config%2Fraw%2Fmaster%2Fimages%2Ffolders.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fgithub.com%2Fjspw%2FVS-Code-Config%2Fraw%2Fmaster%2Fimages%2Ffolders.png" alt="VS CODE Folders"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h5&gt;
  
  
  Not This
&lt;/h5&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fgithub.com%2Fjspw%2FVS-Code-Config%2Fraw%2Fmaster%2Fimages%2Fdont.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fgithub.com%2Fjspw%2FVS-Code-Config%2Fraw%2Fmaster%2Fimages%2Fdont.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Press &lt;code&gt;Ctrl+Shift+b&lt;/code&gt; and your output will be in the output.txt file
&lt;/h2&gt;

&lt;h1&gt;
  
  
  Happy coding :3
&lt;/h1&gt;

</description>
    </item>
    <item>
      <title>Make Competitive Programming Easy with VS Code</title>
      <dc:creator>5hfT</dc:creator>
      <pubDate>Sun, 12 Apr 2020 14:59:19 +0000</pubDate>
      <link>https://forem.com/mh_shifat/how-to-install-and-setup-vs-code-for-competitive-programming-with-c-c-for-windows-users-2med</link>
      <guid>https://forem.com/mh_shifat/how-to-install-and-setup-vs-code-for-competitive-programming-with-c-c-for-windows-users-2med</guid>
      <description>&lt;h1&gt;
  
  
  Make Coding Easy
&lt;/h1&gt;

&lt;p&gt;&lt;strong&gt;This tutorial is for linux (debian based) only &lt;br&gt;&lt;br&gt;
If you are a windows user then check this out &lt;a href="https://dev.to/mhshifat/live-input-output-competitive-programming-setup-in-vs-code-for-c-c-windows-4opp"&gt;Setup VS Code for windows&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  1. &lt;a href="https://github.com/jspw/VS-Code-Config/blob/master/tasks.json" rel="noopener noreferrer"&gt;&lt;strong&gt;VS code task config&lt;/strong&gt; to make &lt;strong&gt;competitive programming&lt;/strong&gt; easy and &lt;strong&gt;programme ananlysis&lt;/strong&gt; !&lt;/a&gt; &lt;br&gt;
&lt;/h3&gt;

&lt;p&gt;This is a &lt;strong&gt;.json&lt;/strong&gt; file which will help you to run your &lt;strong&gt;cpp&lt;/strong&gt; file with one &lt;strong&gt;click&lt;/strong&gt; or &lt;strong&gt;shortcut&lt;/strong&gt;.&lt;br&gt;
In this case , you &lt;strong&gt;don't&lt;/strong&gt; need to write &lt;strong&gt;input&lt;/strong&gt; in the command line or write &lt;strong&gt;fopen&lt;/strong&gt; / &lt;strong&gt;close&lt;/strong&gt; stuffs , programme will take input from a file &lt;strong&gt;(input.txt)&lt;/strong&gt; automatically and give the output in another file &lt;strong&gt;(output.txt)&lt;/strong&gt; .&lt;br&gt;&lt;br&gt;
&lt;br&gt;&lt;br&gt;
You can also find the programme &lt;strong&gt;runtime status&lt;/strong&gt; which will help  you to calculate &lt;strong&gt;execution time&lt;/strong&gt; as well as &lt;strong&gt;memory usage&lt;/strong&gt; and many more !&lt;br&gt;&lt;/p&gt;

&lt;p&gt;pre-requirments : &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Visual Studio Code&lt;/li&gt;
&lt;li&gt;gcc/g++&lt;/li&gt;
&lt;li&gt;time 

&lt;ul&gt;
&lt;li&gt;install time :

&lt;code&gt;sudo apt install time&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;More things to do :&lt;br&gt;
Note : &lt;strong&gt;You just need to do these things only for the first time of your workspace!&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Split screen in 3 sections 
&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fgithub.com%2Fjspw%2FVS-Code-Config%2Fblob%2Fmaster%2Fscreenshots%2Fsplit%2520options.png"&gt;

&lt;ul&gt;
&lt;li&gt;split the main section in right (right mouse click on the .cpp file and u will get the split options)&lt;/li&gt;
&lt;li&gt;then split the right into down (same as above)&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;create a file named &lt;code&gt;input.txt&lt;/code&gt;
&lt;/li&gt;

&lt;li&gt;create a file named &lt;code&gt;output.txt&lt;/code&gt;
&lt;/li&gt;

&lt;li&gt;open input.txt into the upper right section&lt;/li&gt;

&lt;li&gt;open output.txt into the lower right section&lt;/li&gt;

&lt;/ul&gt;

&lt;h4&gt;
  
  
  This will be the final look of your vs code
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fgithub.com%2Fjspw%2FVS-Code-Config%2Fblob%2Fmaster%2Fscreenshots%2Fsetedup%2520vs%2520code.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fgithub.com%2Fjspw%2FVS-Code-Config%2Fblob%2Fmaster%2Fscreenshots%2Fsetedup%2520vs%2520code.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;How to setup :&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Go to Configure Default Build Task...

&lt;ul&gt;
&lt;li&gt;In Menu bar 

&lt;ul&gt;
&lt;li&gt;Clik on terminal (At the top)&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;select configure task&lt;/li&gt;

&lt;li&gt;select create task.json from template (this will create a task.json file in .vscode in your working directory)&lt;/li&gt;

&lt;li&gt;select other and new task.json file will be created&lt;/li&gt;

&lt;li&gt;now copy and paste the my &lt;code&gt;task(cpp).json&lt;/code&gt; {&lt;a href="https://github.com/jspw/VS-Code-Config/blob/master/tasks(cpp).json" rel="noopener noreferrer"&gt;link is here&lt;/a&gt;}   file into your &lt;code&gt;task.json&lt;/code&gt; file&lt;/li&gt;

&lt;li&gt;done&lt;/li&gt;

&lt;/ul&gt;

&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;Usage :&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Run : 

&lt;ul&gt;
&lt;li&gt;Shortcut type : &lt;strong&gt;&lt;code&gt;ctrl+shift+b&lt;/code&gt;&lt;/strong&gt; &lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;You nee to give the input in the &lt;strong&gt;input.txt&lt;/strong&gt; file&lt;/li&gt;

&lt;li&gt;output will be shown in the &lt;strong&gt;output.txt&lt;/strong&gt; file&lt;/li&gt;

&lt;li&gt;##### Bonus : programme status will be shown in the &lt;strong&gt;sys.txt&lt;/strong&gt; file &lt;/li&gt;

&lt;li&gt;people concern about more details such as &lt;strong&gt;binary form&lt;/strong&gt; and &lt;strong&gt;disassemble code&lt;/strong&gt; can check &lt;code&gt;tasks(more).json&lt;/code&gt; &lt;a href="https://github.com/jspw/VS-Code-Config/blob/master/tasks(more).json" rel="noopener noreferrer"&gt;file&lt;/a&gt;
&lt;/li&gt;

&lt;/ul&gt;

&lt;h3&gt;
  
  
  2. &lt;a href="https://github.com/jspw/VS-Code-Config/blob/master/cpp.json" rel="noopener noreferrer"&gt;VS CODE Snippet&lt;/a&gt; :
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;This one is made for my personal usage ,you can add functions as you wish and edit my name and doc&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Download the cpp.json file &lt;/li&gt;
&lt;li&gt;Select User Snippets under &lt;strong&gt;File&lt;/strong&gt; &amp;gt; &lt;strong&gt;Preferences (Code &amp;gt; Preferences on macOS)&lt;/strong&gt;, and then select &lt;strong&gt;cpp.json&lt;/strong&gt; &lt;/li&gt;
&lt;li&gt;copy or replace the cpp.json file with downloaded file and save !&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Happy Coding with VS Code
&lt;/h3&gt;

&lt;p&gt;You can check my git repo &lt;a href="https://github.com/jspw/VS-Code-Config" rel="noopener noreferrer"&gt;VS-Code-Config&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;I have added some more files for python too !&lt;/p&gt;

</description>
      <category>vscode</category>
      <category>cpp</category>
      <category>git</category>
      <category>bash</category>
    </item>
  </channel>
</rss>
