<?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: Jajuan Hall</title>
    <description>The latest articles on DEV Community by Jajuan Hall (@iamjajuan).</description>
    <link>https://dev.to/iamjajuan</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%2F657893%2F5c155fe4-005e-4872-b465-9370fc932145.png</url>
      <title>DEV Community: Jajuan Hall</title>
      <link>https://dev.to/iamjajuan</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/iamjajuan"/>
    <language>en</language>
    <item>
      <title>Introduction to Pointers </title>
      <dc:creator>Jajuan Hall</dc:creator>
      <pubDate>Wed, 18 Aug 2021 01:30:41 +0000</pubDate>
      <link>https://dev.to/iamjajuan/introduction-to-pointers-116f</link>
      <guid>https://dev.to/iamjajuan/introduction-to-pointers-116f</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;A pointer is a memory address. Think of a pointer like a bookmark. A bookmark references a page in a book. A pointer references an address in memory that holds a particular value: string, integer, Boolean, etc. The purpose of pointers is to create data structures such as arrays or graphs. In this post, you will learn how to declare a pointer variable and pointer operations.     &lt;/p&gt;

&lt;h2&gt;
  
  
  Declaring Pointer Variables In C++
&lt;/h2&gt;

&lt;p&gt;Declaring a pointer in C++ is the same as declaring a regular variable, except adding an asterisk behind the variable like the following example.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;int* x;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Pointer Operations
&lt;/h2&gt;

&lt;p&gt;To turn a variable into reference, you would need to use the address-of operator (&amp;amp;). Applying the address-of operator to variable y would convert it to a pointer like the example below.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;int y = 100;

cout &amp;lt;&amp;lt; "Memory Address " &amp;lt;&amp;lt; &amp;amp;y &amp;lt;&amp;lt; " Value " &amp;lt;&amp;lt; y;
//Memory Address 0x7ffe4aa8a4bc Value 100

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

&lt;/div&gt;



&lt;p&gt;If you would like to convert a pointer to a regular variable, you need to use the dereference operator (*) like the example below.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;int y = 100;
int *x = &amp;amp;y;
cout &amp;lt;&amp;lt; "Memory Address " &amp;lt;&amp;lt; x  &amp;lt;&amp;lt; " Value " &amp;lt;&amp;lt; *x;
//Memory Address 0x7fffa5778f94 Value 100

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

&lt;/div&gt;



&lt;p&gt;In the example above pointer x points to variable y. The variables hold the same memory address. If the value of x would have change, so does y. Refer to the example below.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;int y = 100;
int *x = &amp;amp;y;
*x = 200;
cout &amp;lt;&amp;lt; "Value " &amp;lt;&amp;lt; y;
//Value 200
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>cpp</category>
    </item>
    <item>
      <title>Higher-order function in python</title>
      <dc:creator>Jajuan Hall</dc:creator>
      <pubDate>Sat, 24 Jul 2021 14:58:40 +0000</pubDate>
      <link>https://dev.to/iamjajuan/higher-order-function-in-python-54ma</link>
      <guid>https://dev.to/iamjajuan/higher-order-function-in-python-54ma</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;A Higher-order function is a function that takes another function as a parameter or a function that returns a function. The built-in map, filter, and reduce functions are all examples of Higher-order functions. In this post, you will learn about decorators and nested functions.&lt;/p&gt;

&lt;h2&gt;
  
  
  Nested Function
&lt;/h2&gt;

&lt;p&gt;To understand Higher-order functions, you need to know about nested functions.  A nested function is a function within a function. The purpose of nested functions is to hide functionality from the global scope. The inner function cannot be called outside of the function. &lt;/p&gt;

&lt;p&gt;The following is example on how to create a nested function.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;def outer_func(msg):

    def inner_func():
        print(msg)

    return inner_func


# Output: Hello Word
hello_word = outer_func("Hello World")
hello_word()


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

&lt;/div&gt;



&lt;p&gt;You see, the outer function returns the inner function, and the variable "hello_word" is bound by that function. If you would call the inner function outside of the outer, you will receive an error.&lt;/p&gt;

&lt;h2&gt;
  
  
  Decorator
&lt;/h2&gt;

&lt;p&gt;A decorator is a simple way to pass a function as a parameter. A benefit of decorators is that it adds functionality to existing functions. Another benefit because it makes your code readable or pythonic. &lt;/p&gt;

&lt;p&gt;The following is an example of how to use a decorator.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;def double(f):

    def inner_func(*args):

        result = f(*args) * 2

        return  result


    return inner_func


@double
def add(x,y):

    return  x + y

@double
def subtract(x,y):

    return  x - y

#Output: 6
result = add(1,2)

print(result)

#Output: 8
result = subtract(5,1)

print(result)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Just like our previous example, the outer function returns the inner function. The annotation is used to call the outer function while the function below is passed as a parameter. A parameter inside the inner function is the same as a parameter in the function it decorates.  Adding a * to your parameter allows your function to take varying inputs.&lt;/p&gt;

</description>
      <category>python</category>
      <category>composition</category>
    </item>
  </channel>
</rss>
