<?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: Kristi</title>
    <description>The latest articles on Forem by Kristi (@kristi).</description>
    <link>https://forem.com/kristi</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%2F596269%2Fafc48dba-1cda-4517-b439-696785ca397b.jpg</url>
      <title>Forem: Kristi</title>
      <link>https://forem.com/kristi</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/kristi"/>
    <language>en</language>
    <item>
      <title>Singly linked lists</title>
      <dc:creator>Kristi</dc:creator>
      <pubDate>Sat, 26 Mar 2022 15:49:28 +0000</pubDate>
      <link>https://forem.com/kristi/singly-linked-lists-1892</link>
      <guid>https://forem.com/kristi/singly-linked-lists-1892</guid>
      <description>&lt;h2&gt;
  
  
  What is a linked list?
&lt;/h2&gt;

&lt;p&gt;A linked list is a collection of objects called nodes that are randomly stored in memory.&lt;/p&gt;

&lt;h3&gt;
  
  
  What is a node?
&lt;/h3&gt;

&lt;p&gt;Node is a combination of two different types: &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;data stored at the particular address which can be char, int, float, string&lt;/li&gt;
&lt;li&gt;pointer to the address of the next node in memory
The last node of the list contains a pointer to &lt;code&gt;NULL&lt;/code&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  What is a singly linked list?
&lt;/h2&gt;

&lt;p&gt;A singly linked list is a linked list that can be traversed only in the forward direction from &lt;code&gt;head&lt;/code&gt; to the last node, &lt;code&gt;tail&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--hqhTkLFe--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kuks4k3vr73q45rvnety.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--hqhTkLFe--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kuks4k3vr73q45rvnety.png" alt="Linked list" width="667" height="211"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Each square is a node and numbers 5, 10, 15, 20 are the values of the nodes. 2000, 3000, 4000, NULL are the pointer to the address of the next node. So the first node which is called &lt;code&gt;HEAD&lt;/code&gt; points to address 2000 which is the next node and so on. The last node points to &lt;code&gt;NULL&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why use linked list vs array?
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Inserting data in the linked list is very quick but in the array, we have direct access to the element&lt;/li&gt;
&lt;li&gt;The list is not required to be continuously present in the memory&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;This was a basic explanation of what is a singly linked list is. Hope you will find this useful and let me know in the comments if this post needs improvement.&lt;/p&gt;

</description>
      <category>computerscience</category>
      <category>programming</category>
      <category>algorithms</category>
    </item>
    <item>
      <title>C Static Libraries</title>
      <dc:creator>Kristi</dc:creator>
      <pubDate>Tue, 01 Mar 2022 08:14:57 +0000</pubDate>
      <link>https://forem.com/kristi/c-static-libraries-46c6</link>
      <guid>https://forem.com/kristi/c-static-libraries-46c6</guid>
      <description>&lt;h2&gt;
  
  
  What is a static library?
&lt;/h2&gt;

&lt;p&gt;A &lt;strong&gt;static library&lt;/strong&gt; is an archive file containing object files that remain static until the program is recompiled. This static library can be used as a single entity in a linking phase of a program.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why do we use libraries?
&lt;/h2&gt;

&lt;p&gt;Using a static library means only one object file needs to be pulled in during the linking phase. This speeds up the linking phase because there are fewer files to process. The benefit of using a static library is that the functions and other symbols loaded into it are indexed. For this reason, linking a program whose object files are ordered in libraries is faster than linking a program whose object files are separate on the disk.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to create them?
&lt;/h2&gt;

&lt;p&gt;First of all, we include all function prototypes of .c files into the header file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#ifndef MAIN_H
#define MAIN_H

/* all function prototypes */

#endif
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then we compile .c files with &lt;code&gt;gcc -c&lt;/code&gt; command. After this process, we will have .c files compiled into object files '.o' which are necessary for the library.&lt;/p&gt;

&lt;p&gt;The next step now is to create an archive file(static library) with object files '.o' and for this step, we use the command below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ar -rc libexample.a *.o
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;em&gt;ar&lt;/em&gt; is a UNIX command for creating and maintaining library archives&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;-r&lt;/em&gt; is used to replace or add files to archive&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;-c&lt;/em&gt; is used to create a new archive file&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;libexample.a&lt;/em&gt; is the name of the file with the extension '.a' which stands for archive&lt;/li&gt;
&lt;li&gt;And the final step of the command is the selection of all object files&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  How to use them?
&lt;/h2&gt;

&lt;p&gt;After creating the library (archive file) we use it in a program.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;gcc filename.c -L . -lexample -o filename
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;em&gt;gcc&lt;/em&gt; (GNU Compiler Collection) - command to compile C files&lt;/li&gt;
&lt;li&gt;filename - name of the file&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;-L .&lt;/em&gt; - tell the linker that the libraries might be found in the  current directory '.'&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;-l&lt;/em&gt; - links the C file with the library file&lt;/li&gt;
&lt;li&gt;example - the name of the static library (check notes at the end of the article)&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;-o&lt;/em&gt; is used to change the name of the executable file&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;filename&lt;/em&gt; - the name of the executable file&lt;/li&gt;
&lt;/ul&gt;

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

&lt;p&gt;This was a basic explanation of what is a static library, how to create and use them. Hope you find it useful.&lt;/p&gt;

&lt;h3&gt;
  
  
  Notes
&lt;/h3&gt;

&lt;p&gt;We omitted the "lib" and ".a" when mentioning the library on the link command. The linker attaches these parts back to the name of the library to create a name of the file to look for.&lt;/p&gt;

</description>
      <category>c</category>
      <category>computerscience</category>
      <category>programming</category>
      <category>linux</category>
    </item>
    <item>
      <title>Rubber Duck Debugging</title>
      <dc:creator>Kristi</dc:creator>
      <pubDate>Wed, 23 Feb 2022 09:25:45 +0000</pubDate>
      <link>https://forem.com/kristi/rubber-duck-debugging-59a5</link>
      <guid>https://forem.com/kristi/rubber-duck-debugging-59a5</guid>
      <description>&lt;h2&gt;
  
  
  What is debugging?
&lt;/h2&gt;

&lt;p&gt;Debugging is the process of finding and removing bugs(errors) in a software code.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is Rubber Duck Debugging?
&lt;/h2&gt;

&lt;p&gt;Rubber Duck Debugging is a method in computer science of debugging in a way by articulating a problem speaking in natural language.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What does that mean?&lt;/strong&gt; 🤔&lt;br&gt;
You start coding. Then an unexpected error happens. Something is wrong with your code so you have to debug. This is the moment that rubber duck debugging is needed. &lt;br&gt;
Grab a rubber duck or if you don't have one just grab an object and explain to the object your code line by line. By explaining and speaking out loud your code, you may understand what is wrong with it. &lt;br&gt;
You may not find the answer on the first try but this method is effective and has been proved by many programmers.&lt;/p&gt;

&lt;p&gt;I know that there are so many tools for debugging BUT the rubber duck debugging method will help you to understand your code and learn more.&lt;/p&gt;

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

&lt;p&gt;This was a basic explanation for the rubber duck debugging method. Hope you got the idea of what rubber duck debugging is.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;References&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://rubberduckdebugging.com/"&gt;Rubber Duck Debugging Website&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Useful website if you want to talk with a duck and explain the problems of your code&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://en.wikipedia.org/wiki/Debugging"&gt;Debugging&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://en.wikipedia.org/wiki/Rubber_duck_debugging"&gt;Rubber Duck Debugging&lt;/a&gt;&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>programming</category>
      <category>computerscience</category>
    </item>
  </channel>
</rss>
