<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Ridwanur Rahman</title>
    <description>The latest articles on DEV Community by Ridwanur Rahman (@ridwan805).</description>
    <link>https://dev.to/ridwan805</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%2F1252511%2F992bdbc7-e6be-40b7-9536-fa7ed4474de9.jpg</url>
      <title>DEV Community: Ridwanur Rahman</title>
      <link>https://dev.to/ridwan805</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ridwan805"/>
    <language>en</language>
    <item>
      <title>From Information to Impact: How Data Drives Decision-Making.</title>
      <dc:creator>Ridwanur Rahman</dc:creator>
      <pubDate>Sun, 06 Oct 2024 17:12:12 +0000</pubDate>
      <link>https://dev.to/ridwan805/from-information-to-impact-how-data-drives-decision-making-69d</link>
      <guid>https://dev.to/ridwan805/from-information-to-impact-how-data-drives-decision-making-69d</guid>
      <description>&lt;h2&gt;
  
  
  Indroduction
&lt;/h2&gt;

&lt;p&gt;Have you ever wondered what connects industries like e-commerce, healthcare, marketing, and technology? How do companies decide which products to invest in, what equipment to use for manufacturing, or how to improve their customer service?&lt;/p&gt;

&lt;p&gt;The answer lies in data. In every industry, organizations rely on data to improve operations, discover opportunities, identify trends, launch successful products, and make smarter decisions.&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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5t1kktj6z5qqv1dfcass.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%2Fuploads%2Farticles%2F5t1kktj6z5qqv1dfcass.png" alt="Image description" width="128" height="128"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In today’s world, data is more than just numbers on a screen. Businesses, governments, and individuals use data to make decisions that influence their strategies and future outcomes. But with so much data being generated daily, how do we make sense of it all? This is where data analysis comes in.&lt;/p&gt;

&lt;p&gt;Data analysis helps transform large amounts of raw data into meaningful insights. It allows organizations to understand what’s happening, why it’s happening, and what might happen next. Whether it’s improving customer satisfaction, making operations more efficient, or predicting trends, data analysis helps organizations stay ahead.&lt;/p&gt;

&lt;p&gt;By using data analysis, companies can make informed decisions that not only solve problems but also give them a competitive edge in the market.&lt;/p&gt;

&lt;p&gt;So, let’s dive into the world of data analysis and explore how it transforms raw information into powerful insights that drive decisions.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is Data Analysis?
&lt;/h2&gt;

&lt;p&gt;The first question that comes to mind is: what exactly is data analysis, and how does it lead to data-driven decisions?&lt;/p&gt;

&lt;p&gt;Data analysis is the process of collecting, cleaning, organizing, analyzing, and interpreting data to uncover insights and make informed decisions. It transforms raw data into meaningful information, helping businesses and organizations make effective and helpful conclusions.&lt;/p&gt;

&lt;p&gt;Let’s break down the process:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Collecting Data:&lt;/strong&gt; The first and crucial step in data analysis is collecting data from various sources, which can be structured or unstructured. It’s important to ensure the sources are valid and that the data is relevant to the analysis. Ensuring the quality of data at this stage guarantees accurate results.&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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8b0be8qhdkpstfsla6or.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%2Fuploads%2Farticles%2F8b0be8qhdkpstfsla6or.png" alt="Image description" width="512" height="512"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Cleaning Data:&lt;/strong&gt; After collecting the data, the next step is cleaning it. This involves removing duplicate entries, fixing mistakes, and filling in missing information. Sometimes, data needs to be reformatted to maintain consistency. Cleaning data is vital for ensuring the analysis is accurate and reliable.&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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzvnvd2jbb0rax6mdmb4o.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%2Fuploads%2Farticles%2Fzvnvd2jbb0rax6mdmb4o.png" alt="Image description" width="512" height="512"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Analyzing Data:&lt;/strong&gt; Once cleaned, the data is analyzed. Analysts look for patterns, trends, and useful insights using tools like charts, graphs, and statistics. Sometimes more advanced techniques, like machine learning, are employed to extract deeper insights. The goal is to understand what the data reveals to make better decisions.&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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8eo0izbogpugvh86hnvz.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%2Fuploads%2Farticles%2F8eo0izbogpugvh86hnvz.png" alt="Image description" width="512" height="512"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Interpreting Data:&lt;/strong&gt; After analyzing, the next step is to interpret the results. This involves understanding what the findings mean in the context of the problem or decision at hand. For example, if data shows sales are increasing in one region, the analyst might ask why this is happening. The aim is to turn data into clear insights that guide decisions, solve problems, or improve strategies.&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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fo3vritgwn9npuyhj61dk.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%2Fuploads%2Farticles%2Fo3vritgwn9npuyhj61dk.png" alt="Image description" width="512" height="512"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In short, data analysis turns raw data into meaningful insights, helping businesses make smarter, data-driven decisions that lead to better outcomes.&lt;/p&gt;

&lt;h2&gt;
  
  
  The OSEMN framework
&lt;/h2&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%2Fuploads%2Farticles%2F9fhigayoguwklbpnig4o.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%2Fuploads%2Farticles%2F9fhigayoguwklbpnig4o.png" alt="Image description" width="800" height="472"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A data analysis process follows different type of structure. Almost all of them are the same. One of them is OSEMN Framework. The OSEMN framework stands for:&lt;br&gt;
&lt;strong&gt;&lt;em&gt;O&lt;/em&gt;&lt;/strong&gt;: Obtain- Gather data from various sources.&lt;br&gt;
&lt;strong&gt;&lt;em&gt;S&lt;/em&gt;&lt;/strong&gt;: Scrub- Clean the data to ensure accuracy. &lt;br&gt;
&lt;strong&gt;&lt;em&gt;E&lt;/em&gt;&lt;/strong&gt;: Explore- Analyze data to identify patterns and relationships.&lt;br&gt;
&lt;strong&gt;&lt;em&gt;M&lt;/em&gt;&lt;/strong&gt;: Model- Apply models to predict outcomes and insights.&lt;br&gt;
&lt;strong&gt;&lt;em&gt;N&lt;/em&gt;&lt;/strong&gt;: Interpret- Present the findings in a meaningful way. &lt;/p&gt;

&lt;p&gt;Each step is crucial in the journey from raw data to actionable insights, ensuring that the data is reliable and the analysis is accurate.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Obtain:&lt;/strong&gt; Collect data from relevant sources, whether structured (like databases). The quality and relevance of the data gathered directly influence the accuracy and value of the analysis that follows.&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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgug2b0q3ey9srl2oc4dy.jpg" 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%2Fuploads%2Farticles%2Fgug2b0q3ey9srl2oc4dy.jpg" alt="Image description" width="800" height="800"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Scrub:&lt;/strong&gt; Clean the collected data by removing duplicates, fixing errors, and finding missing values. Ensuring clean and accurate data is critical because errors or inconsistencies can lead to incorrect conclusions during the analysis.&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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F44vwt0a03h44ulpo55up.jpg" 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%2Fuploads%2Farticles%2F44vwt0a03h44ulpo55up.jpg" alt="Image description" width="800" height="800"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Explore:&lt;/strong&gt; Explore the data to identify patterns and trends. Tools like charts, graphs, and visualizations are used to better understand relationships within the data, helping data analysts discover insights.&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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fojb41h8pv3wtpdfdjoeo.jpg" 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%2Fuploads%2Farticles%2Fojb41h8pv3wtpdfdjoeo.jpg" alt="Image description" width="800" height="800"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Model:&lt;/strong&gt; In the next step, we apply statistical methods to create models that predict future outcomes or provide solutions to business questions. These models can help answer questions like predicting customer behavior or estimating future sales.&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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F56mwco8ehv1qkv8rd511.jpg" 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%2Fuploads%2Farticles%2F56mwco8ehv1qkv8rd511.jpg" alt="Image description" width="800" height="533"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;iNterpret:&lt;/strong&gt; Finally, we present the insights gained from the analysis clearly and concisely using visualizations, reports, or dashboards. This step is crucial for helping stakeholders understand the findings and make data-driven decisions based on the results.&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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpptfkgbfvoldx7gog0k6.jpg" 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%2Fuploads%2Farticles%2Fpptfkgbfvoldx7gog0k6.jpg" alt="Image description" width="800" height="533"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  How the OSEMN Framework Drives Decision-Making?
&lt;/h2&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%2Fuploads%2Farticles%2F8r0q37utdqfibj4iaic8.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%2Fuploads%2Farticles%2F8r0q37utdqfibj4iaic8.png" alt="Image description" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The OSEMN framework is a powerful tool that helps the data be transformed into effective and insightful business strategies. Each step of this process is designed to convert raw data into effective insights.&lt;/p&gt;

&lt;p&gt;If we start from the beginning of the OSEMN Framework, by obtaining the relevant data, the data analyst ensures they have the right data or information to support the further step in making an effective decision. So, it is important to collect the data carefully, as it helps us understand and shape the quality of future decisions.&lt;/p&gt;

&lt;p&gt;After obtaining the data, a data analyst needs to remove the errors and all the inconsistencies so that it would not lead to flawed decision-making. Scrubbing the data leads a data analyst to ensure the business that the insights they derive are based on seamless information and there are no duplicate or missing values in it. &lt;/p&gt;

&lt;p&gt;Next, exploring the data is the key to understanding the pattern and trends within the data. In this stage, a data analyst takes the help of various visualization tools to understand and visualize the data, which eventually helps us in the data driven decisions.&lt;/p&gt;

&lt;p&gt;Now, modeling the data helps and allows us to recognize the hidden patterns in the data. The basic idea is that we feed in a set of known data and use an algorithm to create a mathematical representation of the relationship between the input and output variables we're trying to predict.  This helps leaders make data-backed decisions, minimizing risks and optimizing results.&lt;/p&gt;

&lt;p&gt;Finally, interpreting the data makes the data into impactful results. Here a data analyst can finally make a decision based on the previous step and give how the business can launch new products or enter new markets&lt;/p&gt;

&lt;h2&gt;
  
  
  Data Analyst vs. Data Scientist:
&lt;/h2&gt;

&lt;p&gt;We often get confused and mix the roles of a data analyst and data scientist. While both data analysts and data scientists work with data, their roles, tools, and responsibilities differ significantly. &lt;/p&gt;

&lt;p&gt;A &lt;strong&gt;data analyst&lt;/strong&gt; focuses on working with structured data to identify patterns, build reports, and extract meaningful insights that help organizations make informed decisions. Their primary tasks include collecting, cleaning, organizing, and visualizing data using tools like Excel, SQL, and Tableau.&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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fiesi1lpcrbh9lvnww5nj.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%2Fuploads%2Farticles%2Fiesi1lpcrbh9lvnww5nj.png" alt="Image description" width="800" height="387"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Whereas, a &lt;strong&gt;data scientist&lt;/strong&gt; often works with both structured and unstructured data, applying more advanced techniques like machine learning and predictive modeling to extract deeper insights. They build algorithms, create models, and work on complex data problems to predict future outcomes or behaviors. They use advanced statistics and predictive analytics, machine&lt;br&gt;
learning, and data modeling, high-level, object-oriented&lt;br&gt;
programming, Hadoop, MySQL, TensorFlow, and Spark&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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Firs6gnd0np80joo87wjt.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%2Fuploads%2Farticles%2Firs6gnd0np80joo87wjt.png" alt="Image description" width="626" height="484"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Data analysis is a powerful tool that helps organizations make informed, data-driven decisions. From collecting and cleaning data to modeling and interpreting it, the process transforms raw information into valuable insights. The OSEMN framework guides this process, ensuring that every step, from obtaining to interpreting data, leads to actionable outcomes&lt;/p&gt;

&lt;p&gt;Whether you're a data analyst or a business professional, using data for decision-making is key in today’s world. By analyzing data well, organizations can improve their plans, run more efficiently, and stay competitive.&lt;/p&gt;

&lt;p&gt;So, data analysis connects all sorts of industries together and unlocks the potential of data to shape a better future of decision making.&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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgw8zt3aizzfhgx1cskrl.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%2Fuploads%2Farticles%2Fgw8zt3aizzfhgx1cskrl.png" alt="Image description" width="450" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>data</category>
      <category>datascience</category>
      <category>analytics</category>
    </item>
    <item>
      <title>Stuck between C and C++</title>
      <dc:creator>Ridwanur Rahman</dc:creator>
      <pubDate>Thu, 14 Mar 2024 20:59:01 +0000</pubDate>
      <link>https://dev.to/ridwan805/stuck-between-c-and-c-1nnb</link>
      <guid>https://dev.to/ridwan805/stuck-between-c-and-c-1nnb</guid>
      <description>&lt;h2&gt;
  
  
  INTRODUCTION
&lt;/h2&gt;

&lt;p&gt;Choosing between C and C++ can be a daunting task for many programmers, as both languages offer unique features and advantages.  Let's delve into each language to better understand its characteristics and applications.&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%2Fhp8e8atp5hzuidtsk0mk.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%2Fhp8e8atp5hzuidtsk0mk.png" alt="Image description" width="268" height="188"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What are C and C++?
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;C Programming&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;As we all know, C is the mother of all programming languages. C is a structural programming language that can be used to develop an operating system, compilers, websites, drivers, and browsers.&lt;/p&gt;

&lt;p&gt;C has become popular because of its execution speed, simplicity, and flexibility. It became the base for many other programming languages. If a user knows C, then it is easy for them to learn all other programming languages&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%2Fcd2ctqtcswk9een1mfiv.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%2Fcd2ctqtcswk9een1mfiv.png" alt="Image description" width="800" height="600"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;C++&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;C++ is the updated and much easier version of C. It is also known as C with classes, as the general purpose of C++ is OOP (object-oriented programming). It has the properties of both structural and object-oriented programming. C++ is used with graphics applications, operating systems, smartwatches, game development, cloud-distributed systems, compilers, etc. The reason for C++'s popularity is its excellent performance while being a high-level object-oriented language.&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%2Fui6imtsxgiqxgm0st5u5.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%2Fui6imtsxgiqxgm0st5u5.png" alt="Image description" width="800" height="355"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Advantages of C
&lt;/h2&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%2Fm2d1pizahv6ryb5yo7o3.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%2Fm2d1pizahv6ryb5yo7o3.png" alt="Image description" width="800" height="355"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Efficiency and Speed&lt;/strong&gt;: C's efficiency and speed stem from its low-level operations, granting direct access to memory and hardware resources, making it ideal for real-time systems, scientific computing, and game development.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Execution Optimization&lt;/strong&gt;: Developers can fine-tune code for speed in C, crucial for high-performance applications.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Resource Management&lt;/strong&gt;: Direct memory access in C enables efficient resource management, vital for applications with strict resource constraints.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Close-to-Hardware Programming&lt;/strong&gt;: C's proximity to hardware makes it perfect for system-level programming tasks like developing operating systems, device drivers, and firmware.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Strong Community Support and Libraries&lt;/strong&gt;: The vibrant C community and extensive libraries expedite development and troubleshooting processes.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Ideal for System Programming and Embedded Systems&lt;/strong&gt;: C's efficiency and control make it a top choice for developing operating systems and firmware in embedded systems.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Portability Across Platforms&lt;/strong&gt;: C's portability allows code to run on various platforms with minimal modifications, facilitating cross-platform development.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Legacy Code and Integration Capabilities&lt;/strong&gt;: The abundance of legacy C code offers opportunities for maintaining and integrating existing systems effectively.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Low-Level Manipulation and Memory Management&lt;/strong&gt;: C enables precise data manipulation and custom memory allocation strategies, providing developers with unparalleled control over the system.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Advantages of C++
&lt;/h2&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%2F0t9n57j8i4cwmchrwj2i.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%2F0t9n57j8i4cwmchrwj2i.png" alt="Image description" width="800" height="355"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Efficiency and Speed&lt;/strong&gt;: C++ combines low-level control with object-oriented features, offering efficiency and speed crucial for systems programming, game development, and scientific computing.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Portability and Object-Oriented&lt;/strong&gt;: C++ is portable across platforms and emphasizes object-oriented principles like classes, inheritance, polymorphism, and encapsulation, enhancing code reusability and reliability.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Multi-Paradigm Programming&lt;/strong&gt;: C++ supports multiple paradigms including generic, imperative, and object-oriented programming, making it highly versatile for various programming styles.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Low-Level Control with High-Level Features&lt;/strong&gt;: C++ provides developers with low-level control for tasks like memory manipulation while offering high-level abstractions for convenient program design.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Efficiency and Performance&lt;/strong&gt;: Running close to hardware limits, C++ programs are known for their efficiency, speed, and ability to perform well under heavy hardware constraints.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Extensive Libraries and Ecosystem&lt;/strong&gt;: C++ boasts a mature ecosystem of libraries and frameworks that accelerate development processes for tasks like network programming, graphics rendering, and database access.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Disadvantages of C &amp;amp; C++
&lt;/h2&gt;

&lt;p&gt;Now, let's talk about the disadvantages of both languages.&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%2Fp5d1awil9ettreyyg0nc.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%2Fp5d1awil9ettreyyg0nc.png" alt="Image description" width="800" height="355"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Disadvantages of C:
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Lack of Object-Oriented Programming (OOPs) concepts&lt;/strong&gt;: C, despite its extensive capabilities, lacks fundamental OOPs features such as Inheritance, Polymorphism, Encapsulation, Abstraction, Data Hiding, overloading, and overriding. This absence can complicate real-world problem-solving for programmers.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Run-Time Execution Error Handling:&lt;/strong&gt; Unlike some other languages, C does not detect errors or bugs after each line of code. Instead, errors are typically shown after the entire program is written, making debugging complex, especially in large codebases.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Absence of Namespaces:&lt;/strong&gt; C lacks the concept of namespaces, making it challenging to declare variables without the risk of naming conflicts. This limitation contributes to C being viewed as an outdated language.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Memory Management Challenges:&lt;/strong&gt; While C automatically allocates memory when needed, managing memory dynamically using functions like malloc requires careful consideration of memory management techniques, which can be daunting for developers.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Lack of Garbage Collection:&lt;/strong&gt; Unlike languages with automatic garbage collection, such as Java, C does not have built-in support for reclaiming memory from unused objects. Implementing a precise garbage collector in C/C++ can be technically complex and costly.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Missing Constructor and Destructor:&lt;/strong&gt; C lacks support for constructors and destructors, essential features in OOPs, which help manage memory occupation by objects. This absence can make certain programming tasks less efficient.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Inadequate Exception Handling:&lt;/strong&gt; Unlike many other languages, C lacks optimized exception handling, resulting in slower error responses. This deficiency can impede the development process and make error resolution more challenging.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Disadvantages of C++ :
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;In C++, referencing the same object from different starting points can lead to significant problems within the codebase.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Java uses a 16-bit Unicode to ASCII conversion, while C++ operates on an 8-bit system, resulting in memory savings but potentially limiting character representation.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;C++ is commonly used for platform-specific applications, often selecting specific libraries tailored to the target OS or platform.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Garbage collection is not supported in C++, and features like pointers, friend functions, and global variables can pose security risks.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Without careful optimization, C++ programs can become heavy, especially with classes, overloaded functions, and symbol mangling complexities.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Despite being considered low-level, C++ may not always be the optimal choice for platform-dependent applications, and it can be complex to maintain and debug.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Learning and mastering C++ can be challenging, particularly for newcomers to programming due to its complexity and power.&lt;/p&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%2Fuploads%2Farticles%2Fhqjol0l7ag0wa4gpnqyq.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%2Fhqjol0l7ag0wa4gpnqyq.png" alt="Image description" width="800" height="355"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Which one to use?
&lt;/h1&gt;

&lt;p&gt;Deciding between using C and C++ depends on various factors including the project requirements, development goals, and team expertise. Here's a guideline:&lt;/p&gt;

&lt;p&gt;Use C when:&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%2Fssm9y2mk0cbyrzh9th3b.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%2Fssm9y2mk0cbyrzh9th3b.png" alt="Image description" width="800" height="355"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Working on projects where low-level hardware interaction or system programming is required.&lt;/li&gt;
&lt;li&gt;Developing embedded systems or operating systems where direct control over hardware resources is crucial.&lt;/li&gt;
&lt;li&gt;Needing maximum portability across different platforms and architectures.&lt;/li&gt;
&lt;li&gt;Seeking high performance with minimal overhead and resource usage.&lt;/li&gt;
&lt;li&gt;Working in environments where the simplicity and minimalism of C are preferred.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Use C++ when:&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%2F59s3xrkvswz13acnsda6.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%2F59s3xrkvswz13acnsda6.png" alt="Image description" width="800" height="355"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Building large-scale software projects that require complex data structures, algorithms, and extensive libraries.&lt;/li&gt;
&lt;li&gt;Developing applications that benefit from object-oriented design principles, such as reusability and modularity.&lt;/li&gt;
&lt;li&gt;Creating graphical user interfaces (GUIs), games, or multimedia applications that require rich features and abstraction.&lt;/li&gt;
&lt;li&gt;Utilizing modern software engineering practices such as design patterns, encapsulation, and inheritance.&lt;/li&gt;
&lt;li&gt;Working in environments where productivity and maintainability are important, as C++ offers features like namespaces and exceptions handling.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Ultimately, the choice between C and C++ depends on the specific needs and constraints of the project, as well as the preferences and expertise of the development team.&lt;/p&gt;

&lt;h1&gt;
  
  
  Conclusion:
&lt;/h1&gt;

&lt;p&gt;In conclusion, while C and C++ are powerful programming languages with extensive capabilities, they also come with their own set of challenges. Both languages lack built-in support for key features like Object-Oriented Programming (OOPs) concepts and automatic garbage collection, which can make coding complex and error-prone. Additionally, memory management, naming conflicts, and platform-specific considerations add to the difficulty of working with these languages. Despite their complexities, mastering C and C++ can provide developers with unparalleled control and performance, but it requires dedication and thorough understanding to overcome the inherent hurdles.&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%2Fhj2zpo8l74bz3wwakxrt.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%2Fhj2zpo8l74bz3wwakxrt.png" alt="Image description" width="800" height="510"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>cprogramming</category>
      <category>beginnerr</category>
    </item>
    <item>
      <title>Pointer 3: (*Function Pointers) ☝️</title>
      <dc:creator>Ridwanur Rahman</dc:creator>
      <pubDate>Sun, 11 Feb 2024 08:07:00 +0000</pubDate>
      <link>https://dev.to/ridwan805/pointer-3-function-pointers-3b92</link>
      <guid>https://dev.to/ridwan805/pointer-3-function-pointers-3b92</guid>
      <description>&lt;h2&gt;
  
  
  What are function pointers?
&lt;/h2&gt;

&lt;p&gt;Function pointers are like normal pointers, but they have the capability to point to a function.&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%2F0scnmx30vv7cdgyvjz65.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%2F0scnmx30vv7cdgyvjz65.png" alt="Image description" width="695" height="373"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here, this is a normal function that gives the sum of two numbers. Now what the function pointer does is store the address of a function.&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%2Fwf81ynjm3kvjkb3b1fdl.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%2Fwf81ynjm3kvjkb3b1fdl.png" alt="Image description" width="527" height="366"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here, ptr is a pointer function that stores the address of the function add.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to declare the pointers in a function?
&lt;/h2&gt;

&lt;p&gt;In the above second example, we can see that before declaring the *ptr function pointer, we used (). We could simply write &lt;code&gt;*ptr(int,int)= add&lt;/code&gt;. But in C, operator precedence plays a role here, and () precedence is higher than *. So the function will be ptr, which declares an argument with two int types, which will eventually give an error as ptr will act as an int pointer of an integer type. For this, use &lt;code&gt;(*ptr)(int,int)= add&lt;/code&gt; which will allow the precedence to take &lt;code&gt;(*ptr)&lt;/code&gt; first. Let us see an example:&lt;br&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%2Fkjdfcuwk1secrdgt98xq.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%2Fkjdfcuwk1secrdgt98xq.png" alt="Image description" width="345" height="370"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Declaring Array of function pointers
&lt;/h2&gt;

&lt;p&gt;Like a normal &lt;a href="https://dev.to/ridwan805/pointer-2-array-pointersand-pointers-arithmetic-5507"&gt;array pointer&lt;/a&gt; , we can also declare the array of a function pointer.&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%2F9kvoklzmx7s8gghb6bsl.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%2F9kvoklzmx7s8gghb6bsl.png" alt="Image description" width="800" height="832"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If we give input 0–2, then the array of function pointers will work on the cal as it deals with the integer function. And cal is an array that stores the integer functions, and when the input &lt;code&gt;num&lt;/code&gt; is 3, it reads the &lt;code&gt;cal2[0]&lt;/code&gt; array of function pointers that deal with the float functions, i.e., the cal2 pointer array stores the float functions.&lt;/p&gt;

&lt;h2&gt;
  
  
  Passing function Pointer as Argument in a Function
&lt;/h2&gt;

&lt;p&gt;Like normal data pointers, a function pointer can also be passed as an argument in a function, which will return from a function.&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%2Fmbdgnzlnwlfnx2wkhj8o.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%2Fmbdgnzlnwlfnx2wkhj8o.png" alt="Image description" width="800" height="560"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here, &lt;code&gt;info_int&lt;/code&gt; and &lt;code&gt;info_char&lt;/code&gt; are two simple functions, where one takes integer parameters and the other takes char/string parameters. The &lt;strong&gt;Overall&lt;/strong&gt; function is the pointer function, which is pointing to the functions &lt;code&gt;info_int&lt;/code&gt; and &lt;code&gt;info_char&lt;/code&gt; and taking two function parameters, where one is an int type with three integer parameters and the other is a string/char type with two char/string parameters.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;OUTPUT&lt;/strong&gt;&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%2Fx06v084w2fzwyq314yzg.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%2Fx06v084w2fzwyq314yzg.png" alt="Image description" width="186" height="125"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/Ridwan805/Pointers/tree/main/3%20Funtion%20pointers"&gt;&lt;strong&gt;EXAMPLES&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Pointer 2 : {a,r,r,a,y} Pointers🫵and ➖Pointers Arithmetic ➕</title>
      <dc:creator>Ridwanur Rahman</dc:creator>
      <pubDate>Sun, 21 Jan 2024 13:05:15 +0000</pubDate>
      <link>https://dev.to/ridwan805/pointer-2-array-pointersand-pointers-arithmetic-5507</link>
      <guid>https://dev.to/ridwan805/pointer-2-array-pointersand-pointers-arithmetic-5507</guid>
      <description>&lt;p&gt;Previously, we saw the basics of Pointers. Now let us get some ideas on pointers to Array. &lt;/p&gt;

&lt;h2&gt;
  
  
  How are array pointers formed?
&lt;/h2&gt;

&lt;p&gt;In C programming, if we want to access multiple memory locations of the same data type, we can use array pointers. We can simply access the data by &lt;strong&gt;dereferencing&lt;/strong&gt; the pointers pointing to it. Suppose we have an array of length 3, and the elements are 1, 2, and 3.&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%2F7r6r46yah2rufq5o344n.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%2F7r6r46yah2rufq5o344n.png" alt="Image description" width="691" height="435"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;output&lt;/strong&gt; will be &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%2Firvp3pzx3ujxuh1xbj3h.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%2Firvp3pzx3ujxuh1xbj3h.png" alt="Image description" width="254" height="64"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here, in the above example, we can see the memory location of each variable is different, which is stored in an array.&lt;/p&gt;

&lt;p&gt;The syntax of the array pointer is simple.&lt;br&gt;
&lt;strong&gt;&lt;em&gt;Data_type (*name)[size_of_the_array]&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
&lt;em&gt;&lt;strong&gt;While naming the variable of the pointer in terms of  array, we must use ().&lt;/strong&gt;&lt;/em&gt;&lt;br&gt;
&lt;strong&gt;One thing to note down is that&lt;/strong&gt; the pointer that points the 0th element of the array and the pointer that points the whole array are completely different.&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%2Fx3ghxq95z020l99pb5fh.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%2Fx3ghxq95z020l99pb5fh.png" alt="Image description" width="800" height="533"&gt;&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;OUTPUT&lt;/strong&gt; &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%2Fdyskfzhrv5id97gdhsej.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%2Fdyskfzhrv5id97gdhsej.png" alt="Image description" width="706" height="43"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here, p is a base-type integer, which is 4 bytes, whereas the base-type of parr is the size of the arr which is in this case 20 bytes.&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%2F8sei8gdy8r62rcd8t76i.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%2F8sei8gdy8r62rcd8t76i.png" alt="Image description" width="800" height="301"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;OUTPUT&lt;/strong&gt;&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%2Fwn2c6jf3ownhgn9zvsx8.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%2Fwn2c6jf3ownhgn9zvsx8.png" alt="Image description" width="384" height="44"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So when we are using parr++, the pointer is shifted after 20 bytes. &lt;/p&gt;

&lt;h2&gt;
  
  
  Pointer Arithmetic
&lt;/h2&gt;

&lt;h2&gt;
  
  
  POINTER ADDITION AND SUBSTRACTION
&lt;/h2&gt;

&lt;p&gt;Suppose we have a pointer pt and an array of length 6. Now we want to point to the address of the first element of the array. So the memory address of the first element will be pt = &amp;amp;array[0].&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%2Fprglq06tqfpqoxafdfuc.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%2Fprglq06tqfpqoxafdfuc.png" alt="Image description" width="376" height="288"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now suppose we want to find out the memory location of the 4th element of the array. Now we can simply write pt = &amp;amp;arr[3], since the 4th element will be in the 3rd index.&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%2Fzoxsrhkl3vqvjlds2jpb.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%2Fzoxsrhkl3vqvjlds2jpb.png" alt="Image description" width="469" height="293"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;There is another way to do this as well, which is by just adding.&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%2Fd1dryg8m5u3cbws1vp6o.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%2Fd1dryg8m5u3cbws1vp6o.png" alt="Image description" width="411" height="374"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;OUTPUT&lt;/strong&gt;&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%2Fm8gs279ir47n6dlfdf08.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%2Fm8gs279ir47n6dlfdf08.png" alt="Image description" width="174" height="46"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;pt = pt + 3 refers to the memory location of the 3rd index of the pointer. Here, (pt = pt+3) is equivalent to (pt = &amp;amp;arr[3]).&lt;/p&gt;

&lt;p&gt;Here, what is happening during the pointer addition is that it adds 4 bytes in each increment. And the int type is 4 bytes, so for each increment, the pointer moves to 4 bytes of space.&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%2Fpb7pkqk1o62kg2zpr8gj.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%2Fpb7pkqk1o62kg2zpr8gj.png" alt="Image description" width="800" height="390"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;OUTPUT&lt;/strong&gt;&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%2F3gg6ukykj1pjhd07uu50.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%2F3gg6ukykj1pjhd07uu50.png" alt="Image description" width="475" height="135"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;Pointer subtraction&lt;/strong&gt;&lt;/em&gt; is also similar to addition. In addition, while adding, we were accessing the pointer to the next element of the index after 4 bytes. Whereas in the case of subtraction, we just have to go back 4 bytes to access the previous memory location of the element in the array.&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%2Fa215y7nbo47p5hcm9tb1.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%2Fa215y7nbo47p5hcm9tb1.png" alt="Image description" width="800" height="403"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;OUTPUT&lt;/strong&gt;&lt;br&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%2F81a1qd8i7r8723zg2uj2.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%2F81a1qd8i7r8723zg2uj2.png" alt="Image description" width="470" height="153"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Subtraction of two pointer
&lt;/h2&gt;

&lt;p&gt;Suppose we want to know what the increment is between two elements of an array through two pointers. The subtraction of two pointers basically gives the increment between the two pointers.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note that the two pointers must be of same type.&lt;/strong&gt;&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%2Fxven9c7sx75l7mhkkwp8.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%2Fxven9c7sx75l7mhkkwp8.png" alt="Image description" width="791" height="409"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;OUTPUT&lt;/strong&gt; &lt;br&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%2Ft1wqefurgrr176u1pwnx.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%2Ft1wqefurgrr176u1pwnx.png" alt="Image description" width="209" height="31"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here, the increment between the first index and the last index is 5. What's happening here is that suppose the memory location of the 0th index is 1000, so by the 5th index, the memory location will be 1020. And we put the memory location of the 0th index in ptr1 and the 5th index in ptr2. After subtracting ptr1 from ptr2, we get 20, and since the size of the int type is 4 bytes, 20/4 = 5. So the increment is 5.&lt;/p&gt;

&lt;h2&gt;
  
  
  Pointer increment and decrement
&lt;/h2&gt;

&lt;p&gt;Let's start with the concept of &lt;strong&gt;post-increment&lt;/strong&gt;. Post-increment is such that first the value will be assigned, then the increment will be done.&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%2Fgpct1jrxl0j0cqs8rl38.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%2Fgpct1jrxl0j0cqs8rl38.png" alt="Image description" width="654" height="311"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;OUTPUT&lt;/strong&gt;&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%2Fswt481j7is9tqnlcfnbh.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%2Fswt481j7is9tqnlcfnbh.png" alt="Image description" width="104" height="48"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here, we can see that the first output is 2, which is the first element. Let the base address be 1000. Now what pt++ is doing is first assigning the value of the address 1000, then incrementing it to the next element address, which is 1004, and then printing the value of that address.&lt;br&gt;
Another thing is &lt;strong&gt;pre-increment&lt;/strong&gt;. In pre-increment, the value is assigned after the increment is done.&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%2F13a0r6zz1v0x4zfk6kq6.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%2F13a0r6zz1v0x4zfk6kq6.png" alt="Image description" width="725" height="319"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;OUTPUT&lt;/strong&gt;&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%2Fxqpeqqosy71dauvmqv4t.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%2Fxqpeqqosy71dauvmqv4t.png" alt="Image description" width="39" height="49"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Similarly, the pointer decrement also happens in this way. It also happens in post-decrement and pre-decrement ways.&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%2Ffehrc6r6lnuvprf13l2f.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%2Ffehrc6r6lnuvprf13l2f.png" alt="Image description" width="726" height="319"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;OUTPUT&lt;/strong&gt;&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%2Fo8zb6xnp9s2itm36uwgi.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%2Fo8zb6xnp9s2itm36uwgi.png" alt="Image description" width="45" height="44"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here, the pointer points to the address of the 3rd element, and it first prints the 3rd element, and after that, it decrements and prints the 2nd element.&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%2F9fu7j0rudftvlc7g1o6c.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%2F9fu7j0rudftvlc7g1o6c.png" alt="Image description" width="773" height="321"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;OUTPUT&lt;/strong&gt;&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%2Fh12bs2hrykdmpiffucxj.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%2Fh12bs2hrykdmpiffucxj.png" alt="Image description" width="39" height="49"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  POINTER COMPARISION
&lt;/h3&gt;

&lt;p&gt;In C, we can simply compare two pointers by using and implementing all the operators.&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%2Fcl1ki5t6rhzausn5ec9v.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%2Fcl1ki5t6rhzausn5ec9v.png" alt="Image description" width="658" height="405"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;These pointer comparisons can be used to sort an array or find some user input numbers or characters in an array.&lt;/p&gt;

&lt;h3&gt;
  
  
  Example
&lt;/h3&gt;

&lt;p&gt;Some application of pointers are given &lt;a href="https://github.com/Ridwan805/Pointers/tree/main/2%20Array%20to%20pointer%20and%20pointer%20arithmatic"&gt;here&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Pointer 1: Intro to the 👉Pointers👈</title>
      <dc:creator>Ridwanur Rahman</dc:creator>
      <pubDate>Sat, 13 Jan 2024 17:21:48 +0000</pubDate>
      <link>https://dev.to/ridwan805/intro-to-the-pointers-in-c-5c5d</link>
      <guid>https://dev.to/ridwan805/intro-to-the-pointers-in-c-5c5d</guid>
      <description>&lt;p&gt;Here, we will talk about the basic idea of Pointer in C programming. &lt;/p&gt;

&lt;h2&gt;
  
  
  What is a pointer?
&lt;/h2&gt;

&lt;p&gt;Like any variable, &lt;strong&gt;Pointer&lt;/strong&gt; is a variable like a reference that holds a memory to another variable, arrays. &lt;/p&gt;

&lt;p&gt;And many tasks are easily done by pointers. Like, &lt;br&gt;
       • Always works on the original variable. &lt;br&gt;
       • We can easily create any data structure.&lt;br&gt;
       • Searching and sorting huge data very easily. &lt;br&gt;
       • Returning more than one value in the functions.&lt;/p&gt;

&lt;p&gt;Now let’s see the basic and simple form of pointers. Suppose there is an integer variable age, and we want to print the memory location of the variable and also the age.&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%2F6ggcesl13ev0p3gjpqsz.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%2F6ggcesl13ev0p3gjpqsz.png" alt="Image description" width="800" height="265"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;%p is used to display the memory address, and the operator &amp;amp; is used to display the memory location. The output will be:&lt;br&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%2Fyb8bw9r74mcfpxwaoftm.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%2Fyb8bw9r74mcfpxwaoftm.png" alt="Image description" width="525" height="49"&gt;&lt;/a&gt; the memory location will give the hexadecimal.&lt;/p&gt;

&lt;p&gt;We can also store this ‘0061FF1C’ address in a separate variable, like a reference, which is the pointer. Now, to make a pointer, we have to make sure the pointer variable is the same as the variable we are pointing to. If the variable is an integer, then the pointer type will be an integer; if the variable is a character, then the pointer type will be a character.&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%2Fgg146eieopxe77rvn3rw.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%2Fgg146eieopxe77rvn3rw.png" alt="Image description" width="800" height="293"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here, pAge has its own address, but the value stored within it is another address, and we can store it using the &lt;strong&gt;‘*’ or the indirection operator&lt;/strong&gt;.&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%2Fk4lu59pbdb83yxhmv5ar.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%2Fk4lu59pbdb83yxhmv5ar.png" alt="Image description" width="403" height="43"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here, we print the address stored in pAge using %p.&lt;/p&gt;

&lt;h2&gt;
  
  
  POINTER DECLARATION AND POINTER INITIALIZATION
&lt;/h2&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%2F043abg6x5pk0ces6yxn6.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%2F043abg6x5pk0ces6yxn6.png" alt="Image description" width="449" height="65"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If we break it down, then &lt;code&gt;int *pAge;&lt;/code&gt; is declaring the pointer, and &lt;code&gt;int *pAge = &amp;amp;age;&lt;/code&gt; is initializing the pointer, i.e we are storing the memory location of variable age in the pointer pAge.&lt;/p&gt;

&lt;h2&gt;
  
  
  DEREFERENCING
&lt;/h2&gt;

&lt;p&gt;Now, suppose we want to access the value at the stored address. We can simply do it using the &lt;strong&gt;‘*’ or the indirection operator&lt;/strong&gt;. Simply put, we want to find the value at the address, which is called &lt;strong&gt;dereferencing&lt;/strong&gt;.&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%2F2yulpikvq3bd1kti0287.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%2F2yulpikvq3bd1kti0287.png" alt="Image description" width="800" height="306"&gt;&lt;/a&gt;&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%2Fgwnmj022vc957d1uv3fb.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%2Fgwnmj022vc957d1uv3fb.png" alt="Image description" width="411" height="54"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  POINTERS ONLY USING THE OPERATORS
&lt;/h2&gt;

&lt;p&gt;There is another way by which we can find the value stored in a memory address without assigning a pointer using '%d', '%c', or ‘%f’ based on the type of variable. For example.&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%2Fedw3v7vvs3qevjpcvqxp.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%2Fedw3v7vvs3qevjpcvqxp.png" alt="Image description" width="800" height="408"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;OUTPUT&lt;/strong&gt; &lt;br&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%2Fl2nlg3m0rumboz7e4l3o.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%2Fl2nlg3m0rumboz7e4l3o.png" alt="Image description" width="146" height="73"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Size of pointers
&lt;/h2&gt;

&lt;p&gt;Now, in C, the size of the pointer varies according to its type.&lt;br&gt;
for example, the size of the int, char, double or float type is different&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%2Fsprqoru6cq0o7p3elk42.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%2Fsprqoru6cq0o7p3elk42.png" alt="Image description" width="783" height="511"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;OUTPUT&lt;/strong&gt;&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%2Fy3jcqi9vq7ixqpw8ytib.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%2Fy3jcqi9vq7ixqpw8ytib.png" alt="Image description" width="260" height="70"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So, from here, we can see that the size of each variable is 8 bytes, but when we assign it to a pointer variable, the size of an integer and a float is 4 bytes, the size of a character is 1 byte, and the size of a double type is 8 bytes.&lt;/p&gt;

&lt;h2&gt;
  
  
  EXAMPLES
&lt;/h2&gt;

&lt;p&gt;Check here for few basic examples of &lt;a href="https://github.com/Ridwan805/Pointers/tree/main/1%20Basics%20of%20pointer"&gt;Pointers&lt;/a&gt; &lt;/p&gt;

&lt;h2&gt;
  
  
  MORE
&lt;/h2&gt;

&lt;p&gt;Since the pointer in C stores the memory address, its size is independent. It depends on the system's architecture. &lt;br&gt;
Pointers are used in many other cases. For example.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;To pass the values by reference &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;To do system-level programming where memory addresses are useful.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;To access the values of an array easily.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;To return Multiple values from a function.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And many more other uses, which we will talk about later.&lt;/p&gt;

</description>
      <category>productivity</category>
      <category>beginners</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
