<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>devkuma – C</title>
    <link>https://www.devkuma.com/en/tags/c/</link>
    <image>
      <url>https://www.devkuma.com/en/tags/c/logo/180x180.jpg</url>
      <title>C</title>
      <link>https://www.devkuma.com/en/tags/c/</link>
    </image>
    <description>Recent content in C on devkuma</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en</language>
    <managingEditor>kc@example.com (kc kim)</managingEditor>
    <webMaster>kc@example.com (kc kim)</webMaster>
    <copyright>The devkuma</copyright>
    
	  <atom:link href="https://www.devkuma.com/en/tags/c/index.xml" rel="self" type="application/rss+xml" />
    
    
      
        
      
    
    
    <item>
      <title>C Language | Computer System Development</title>
      <link>https://www.devkuma.com/en/docs/c/%EC%BB%B4%ED%93%A8%ED%84%B0-%EC%8B%9C%EC%8A%A4%ED%85%9C-%EA%B0%9C%EB%B0%9C/</link>
      <pubDate>Sun, 22 Oct 2017 15:52:10 +0900</pubDate>
      <author>kc@example.com (kc kim)</author>
      <guid>https://www.devkuma.com/en/docs/c/%EC%BB%B4%ED%93%A8%ED%84%B0-%EC%8B%9C%EC%8A%A4%ED%85%9C-%EA%B0%9C%EB%B0%9C/</guid>
      <description>
        
        
        
      </description>
      
      <category>C</category>
      
    </item>
    
    <item>
      <title>C Language | Computer System Development | Program Structure</title>
      <link>https://www.devkuma.com/en/docs/c/%ED%94%84%EB%A1%9C%EA%B7%B8%EB%9E%A8%EC%9D%98-%EA%B5%AC%EC%A1%B0/</link>
      <pubDate>Sun, 22 Oct 2017 15:52:10 +0900</pubDate>
      <author>kc@example.com (kc kim)</author>
      <guid>https://www.devkuma.com/en/docs/c/%ED%94%84%EB%A1%9C%EA%B7%B8%EB%9E%A8%EC%9D%98-%EA%B5%AC%EC%A1%B0/</guid>
      <description>
        
        
        &lt;p&gt;This article explains how programs work and introduces types of software such as applications and operating systems.&lt;/p&gt;
&lt;h2 id=&#34;software-and-programming&#34;&gt;Software and Programming&lt;/h2&gt;
&lt;p&gt;If you already have programming experience in a language other than C and understand what a program is, you can skip this section.&lt;/p&gt;
&lt;p&gt;Although computer systems differ, every computer runs according to logical information called software. Software consists of programs that record the procedures and information a computer must process. After a computer boots, programs are loaded into the CPU and continue running according to defined procedures until the computer is turned off. A computer cannot operate without software.&lt;/p&gt;
&lt;p&gt;Programs read and processed by the CPU consist of numeric data called machine code. Each value has a meaning defined by the CPU. The CPU reads an instruction, interprets it, and executes it. The operation of determining the location of the next instruction and retrieving it is called a fetch. A working program repeatedly performs this fetch cycle and the instruction execution cycle.&lt;/p&gt;
&lt;p&gt;Most software written by programmers, however, is not designed to run immediately after the computer is powered on. An application, also called application software or an application program, is software created for a specific purpose such as business processing. How does a computer reach the point where it can run application software?&lt;/p&gt;
&lt;p&gt;When the computer is powered on, a predefined program runs first. After hardware initialization is complete, the computer reads a program from a designated storage device. This series of operations is called booting. Only a small number of programmers need detailed knowledge of the boot process.&lt;/p&gt;
&lt;p&gt;After the boot process completes, the operating system starts. An operating system provides control over the physical computer, system management, and a basic working environment. It is also called system software. A computer cannot be used without an operating system. Representative operating systems include Microsoft Windows, Solaris, HP-UX, OS/2, and Linux.&lt;/p&gt;
&lt;p&gt;The software we create runs on top of an operating system. An operating system is also a program and can be created independently, but doing so requires substantial development experience and advanced knowledge of computer science and systems. Application software runs on an operating system, so application developers generally need less hardware knowledge. They can build the programs they want efficiently by using the features provided by the operating system.&lt;/p&gt;
&lt;p&gt;Business applications, games, and even viruses are all application software that run on top of some form of system software.&lt;/p&gt;
&lt;p&gt;This book frequently uses the word &amp;ldquo;system.&amp;rdquo; It is not simply an abbreviation for operating system. It means the entire information-processing environment composed of hardware and software. For example, C may be used to generate data that acts like an intermediate language for large applications that operate in a manner similar to an operating system. Because the target of a C program is not necessarily an operating system, this book often uses the more abstract term &amp;ldquo;system.&amp;rdquo;&lt;/p&gt;

      </description>
      
      <category>C</category>
      
    </item>
    
    <item>
      <title>C Language | Computer System Development | Hardware Configuration</title>
      <link>https://www.devkuma.com/en/docs/c/%ED%95%98%EB%93%9C%EC%9B%A8%EC%96%B4-%EA%B5%AC%EC%84%B1/</link>
      <pubDate>Sun, 22 Oct 2017 15:52:10 +0900</pubDate>
      <author>kc@example.com (kc kim)</author>
      <guid>https://www.devkuma.com/en/docs/c/%ED%95%98%EB%93%9C%EC%9B%A8%EC%96%B4-%EA%B5%AC%EC%84%B1/</guid>
      <description>
        
        
        &lt;p&gt;This article introduces the standard hardware components of a computer and their relationships.&lt;/p&gt;
&lt;h2 id=&#34;computer-structure&#34;&gt;Computer Structure&lt;/h2&gt;
&lt;p&gt;If you already understand computers through experience with another programming language or assembling computers, you can skip to the article about development environments and compilers.&lt;/p&gt;
&lt;p&gt;C is a high-level language, but it is also close to low-level languages. Using C effectively therefore requires some knowledge of computers. This section explains the basics of computer systems.&lt;/p&gt;
&lt;p&gt;A computer receives data, calculates with it, and outputs the result. The five basic components required for this process are input devices, output devices, arithmetic devices, control devices, and storage devices.&lt;/p&gt;
&lt;h3 id=&#34;table-1-five-basic-computer-components&#34;&gt;Table 1. Five Basic Computer Components&lt;/h3&gt;
&lt;table&gt;
  &lt;thead&gt;
      &lt;tr&gt;
          &lt;th&gt;Component&lt;/th&gt;
          &lt;th&gt;Description&lt;/th&gt;
      &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
      &lt;tr&gt;
          &lt;td&gt;Input device&lt;/td&gt;
          &lt;td&gt;Sends data to a computer&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Output device&lt;/td&gt;
          &lt;td&gt;Outputs calculated results&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Arithmetic device&lt;/td&gt;
          &lt;td&gt;Calculates data according to a program&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Control device&lt;/td&gt;
          &lt;td&gt;Controls the operation of other devices&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Storage device&lt;/td&gt;
          &lt;td&gt;Stores data&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;h3 id=&#34;figure-1-relationships-between-the-five-components&#34;&gt;Figure 1. Relationships Between the Five Components&lt;/h3&gt;
&lt;p&gt;&lt;img src=&#34;https://www.devkuma.com/docs/c/5.jpg&#34; alt=&#34;Relationships between the five computer components&#34;&gt;&lt;/p&gt;
&lt;p&gt;Input devices include keyboards, pointing devices such as mice, pens, and touch screens, scanners, optical mark readers, and timers. Displays are representative output devices, but printers and plotters are also output devices.&lt;/p&gt;
&lt;p&gt;The arithmetic device and control device form the central processing unit, or CPU. The CPU manages input and output and controls the computer as a whole.&lt;/p&gt;
&lt;p&gt;A storage device stores data and calculation results. Important storage directly connected to the CPU is called main memory. Programs use main memory to store data and results. Other storage devices, such as hard drives and ROM, are called secondary storage. Main memory loses its data when power is removed but provides fast access. Secondary storage retains data without power but is slower.&lt;/p&gt;
&lt;p&gt;Storage devices hold binary data. A single binary digit is a bit, but CPUs generally process larger units. The smallest processing unit is called a byte, and a byte is commonly eight bits.&lt;/p&gt;
&lt;p&gt;Strictly speaking, a byte is not always eight bits. Its size depends on the computer architecture. The term octet explicitly means eight bits and is common in networking contexts. This book generally treats one byte as eight bits.&lt;/p&gt;
&lt;p&gt;Storage devices assign an address to each byte. This number is called a memory address. Programs use memory addresses to access information. Memory addresses are central to pointers in C. Remember that every piece of data processed by a computer must have an address that identifies its location.&lt;/p&gt;

      </description>
      
      <category>C</category>
      
    </item>
    
    <item>
      <title>C Language | Introduction to C</title>
      <link>https://www.devkuma.com/en/docs/c/c-%EC%96%B8%EC%96%B4-%EC%9E%85%EB%AC%B8/</link>
      <pubDate>Sun, 22 Oct 2017 15:52:10 +0900</pubDate>
      <author>kc@example.com (kc kim)</author>
      <guid>https://www.devkuma.com/en/docs/c/c-%EC%96%B8%EC%96%B4-%EC%9E%85%EB%AC%B8/</guid>
      <description>
        
        
        
      </description>
      
      <category>C</category>
      
    </item>
    
    <item>
      <title>C Language | Introduction to C | Development Environments and Compilers</title>
      <link>https://www.devkuma.com/en/docs/c/%EA%B0%9C%EB%B0%9C-%ED%99%98%EA%B2%BD-%EB%B0%8F-%EC%BB%B4%ED%8C%8C%EC%9D%BC%EB%9F%AC/</link>
      <pubDate>Sun, 22 Oct 2017 15:52:10 +0900</pubDate>
      <author>kc@example.com (kc kim)</author>
      <guid>https://www.devkuma.com/en/docs/c/%EA%B0%9C%EB%B0%9C-%ED%99%98%EA%B2%BD-%EB%B0%8F-%EC%BB%B4%ED%8C%8C%EC%9D%BC%EB%9F%AC/</guid>
      <description>
        
        
        &lt;p&gt;This article introduces the tools and development environment required for programming in C.&lt;/p&gt;
&lt;h2 id=&#34;tools-required-for-programming&#34;&gt;Tools Required for Programming&lt;/h2&gt;
&lt;p&gt;Every task requires the right tools. Drawing a comic requires paper, ink, pens, rulers, pencils, erasers, and screen tones. Performing music requires not only an instrument but also sheet music, a music stand, a tuner, and a metronome. Programming is no different. A computer alone is not enough. Producing high-quality programs efficiently requires an advanced development environment. A development environment consists of programs used to create other programs, including a debugger for finding errors, an editor for writing code, and CASE tools for automating development processes. These development tools are also programs, so it is possible to create them yourself. However, this article focuses on the basic tools needed for C development.&lt;/p&gt;
&lt;p&gt;C development involves translating a source program into an object program and then organizing it into an executable format. Converting a source program into an object program is called compilation, and the software that performs this conversion is called a compiler. To run source code written in C, you need a compiler. The usual development process is to write a source program in a text editor and convert it into an object program with a compiler. Finally, a linker combines the required object programs to create an executable file. In most cases, the compiler includes the linker and other tools required to produce executables.&lt;/p&gt;
&lt;h3 id=&#34;figure-1-program-creation-flow&#34;&gt;Figure 1. Program Creation Flow&lt;/h3&gt;
&lt;p&gt;&lt;img src=&#34;https://www.devkuma.com/docs/c/flow.png&#34; alt=&#34;Program creation flow&#34;&gt;&lt;/p&gt;
&lt;p&gt;There are various ways to obtain a compiler. A Windows user who is new to computers may prefer an integrated development environment such as Microsoft Visual C++. An integrated development environment provides an editor, compiler, documentation, and tools for developing graphical software. It lets you compile, link, and run a C program with the click of a button, making it approachable for beginners and suitable for serious development.&lt;/p&gt;
&lt;p&gt;Free compilers are also available online. One example is Borland C++ Compiler, formerly provided by Embarcadero. It was released for personal development and learning without a warranty. However, because it is not an integrated development environment, it must be used from the command line.&lt;/p&gt;
&lt;p&gt;The way you compile and run a C program written in a text editor depends on the compiler. C source files generally use the &lt;code&gt;.C&lt;/code&gt; extension. C++ source files use the &lt;code&gt;.CPP&lt;/code&gt; extension.&lt;/p&gt;
&lt;p&gt;Microsoft Visual C++ and Borland C++ Compiler are C++ compilers, but C++ is compatible with C, so you can compile C programs with a C++ compiler. To compile a program as C, use the &lt;code&gt;.C&lt;/code&gt; extension. If you use &lt;code&gt;.CPP&lt;/code&gt;, the compiler treats the source as C++, which may produce errors. Some compilers may let you choose the language with an option regardless of the extension. Refer to your compiler documentation for details.&lt;/p&gt;

      </description>
      
      <category>C</category>
      
    </item>
    
    <item>
      <title>C Language | Introduction to C | Comments</title>
      <link>https://www.devkuma.com/en/docs/c/%EC%A3%BC%EC%84%9D-comment/</link>
      <pubDate>Sun, 22 Oct 2017 15:52:10 +0900</pubDate>
      <author>kc@example.com (kc kim)</author>
      <guid>https://www.devkuma.com/en/docs/c/%EC%A3%BC%EC%84%9D-comment/</guid>
      <description>
        
        
        &lt;p&gt;Comments let you leave notes in source code. They are ignored during compilation and do not affect the program.&lt;/p&gt;
&lt;h2 id=&#34;notes-for-future-readers&#34;&gt;Notes for Future Readers&lt;/h2&gt;
&lt;p&gt;The C sample programs in this book are only a few dozen lines long at most. The source code is kept as simple as possible and excludes unnecessary details so readers can focus on the essential principles covered in each chapter.&lt;/p&gt;
&lt;p&gt;Real-world code, however, contains at least thousands of lines. Large development projects may contain hundreds of thousands or millions of lines. Code at that scale is difficult even for its developers to manage. You may need to read code written by someone else, and even your own code may become difficult to understand when you return to it later.&lt;/p&gt;
&lt;p&gt;For this reason, source code can contain comments that have no effect on program execution. A C comment begins with &lt;code&gt;/*&lt;/code&gt; and ends with &lt;code&gt;*/&lt;/code&gt;. Every character between &lt;code&gt;/*&lt;/code&gt; and &lt;code&gt;*/&lt;/code&gt; is removed during compilation. Because a comment may include newline characters, it can span multiple lines. Comments help explain the source code to other readers and remind you what your own code means when you revisit it later.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Code 1&lt;/strong&gt;&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-c&#34; data-lang=&#34;c&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;#include&lt;/span&gt; &lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;&amp;lt;stdio.h&amp;gt;&lt;/span&gt;&lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;int&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;main&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;()&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;/* This comment does not affect the program. */&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#000&#34;&gt;printf&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;This statement is executed.&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;);&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;/* printf(&amp;#34;This statement is not executed because it is inside a comment.\n&amp;#34;); */&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;/*
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;    Add supplementary explanations that make the source code easier to understand.
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;    A comment may span multiple lines.
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;    */&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;return&lt;/span&gt; &lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;0&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This program contains comments in its source code. Leaving explanatory comments is useful in large development projects. Note, however, that comments cannot be written inside string literals.&lt;/p&gt;
&lt;p&gt;Comments also cannot be nested. For example, if you write &lt;code&gt;/* /* */ */&lt;/code&gt;, only &lt;code&gt;/* /* */&lt;/code&gt; is interpreted as a comment.&lt;/p&gt;
&lt;p&gt;Although not defined in the original C specification, many compilers also support single-line comments. A single-line comment starts with two consecutive slash characters, &lt;code&gt;//&lt;/code&gt;, and continues to the end of the line.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-c&#34; data-lang=&#34;c&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;// This is a comment.
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;// Its scope is one line, so each line needs its own marker.
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000&#34;&gt;printf&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;Kitty on your lap&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;);&lt;/span&gt; &lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;// A comment can also appear after code.
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;/////////// This is also a comment. ///////////
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Single-line comments are part of the C++ language specification rather than the original C specification. However, many modern compilers support C++, so they also permit single-line comments in C code. For example, you can use one to temporarily disable a line while testing a program. If you need to write strictly portable code for an older C standard, avoid this comment style.&lt;/p&gt;
&lt;p&gt;The C comment form &lt;code&gt;/* */&lt;/code&gt; and the &lt;code&gt;//&lt;/code&gt; form added by C++ are common across many programming languages. They are used in C/C++, Java, C#, JavaScript, and other languages.&lt;/p&gt;

      </description>
      
      <category>C</category>
      
    </item>
    
    <item>
      <title>C Language | Introduction to C | Data Input with scanf()</title>
      <link>https://www.devkuma.com/en/docs/c/scanf/</link>
      <pubDate>Sun, 22 Oct 2017 15:52:10 +0900</pubDate>
      <author>kc@example.com (kc kim)</author>
      <guid>https://www.devkuma.com/en/docs/c/scanf/</guid>
      <description>
        
        
        &lt;p&gt;This article explains how to receive values entered from a keyboard with &lt;code&gt;scanf()&lt;/code&gt;.&lt;/p&gt;
&lt;h2 id=&#34;receiving-user-input&#34;&gt;Receiving User Input&lt;/h2&gt;
&lt;p&gt;The programs so far have assigned constants to variables. In real programs, variables are useful for values that change dynamically while the program runs.&lt;/p&gt;
&lt;p&gt;How can a program receive dynamic values? Reading data from a disk file is one option. For example, text loaded from a file and displayed on the screen changes at runtime. Reading files is an intermediate topic, so it is explained later.&lt;/p&gt;
&lt;p&gt;A simpler option is keyboard input. It makes programs more useful and easier to test. Use &lt;code&gt;scanf()&lt;/code&gt; to receive keyboard input. &lt;code&gt;scanf()&lt;/code&gt; is an input counterpart to &lt;code&gt;printf()&lt;/code&gt; and stores keyboard input in specified variables.&lt;/p&gt;
&lt;h3 id=&#34;scanf-function&#34;&gt;scanf() Function&lt;/h3&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-c&#34; data-lang=&#34;c&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;int&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;scanf&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;format&amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;&amp;amp;&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;variableName&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;);&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The first argument is a format string. The remaining arguments specify variables that receive input values. Format specifiers are similar to those used by &lt;code&gt;printf()&lt;/code&gt;: use &lt;code&gt;%d&lt;/code&gt; for an integer and &lt;code&gt;%c&lt;/code&gt; for a character. Place &lt;code&gt;&amp;amp;&lt;/code&gt; before the variable name.&lt;/p&gt;
&lt;p&gt;The &lt;code&gt;&amp;amp;&lt;/code&gt; is required because the function needs the address of the variable. Pointers explain this in detail. For now, remember to place &lt;code&gt;&amp;amp;&lt;/code&gt; before a variable passed to &lt;code&gt;scanf()&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;scanf()&lt;/code&gt; returns the number of fields successfully converted and assigned.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Code 1&lt;/strong&gt;&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-c&#34; data-lang=&#34;c&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;#include&lt;/span&gt; &lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;&amp;lt;stdio.h&amp;gt;&lt;/span&gt;&lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;int&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;main&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;()&lt;/span&gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;int&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;iVar&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;0&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; &lt;span style=&#34;color:#000&#34;&gt;printf&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;정수를 입력해 주세요. &amp;gt; &amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;);&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#000&#34;&gt;scanf&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;%d&amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;&amp;amp;&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;iVar&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;);&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#000&#34;&gt;printf&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;입력한 수는 %d입니다.&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;iVar&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;);&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;return&lt;/span&gt; &lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;0&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;When Code 1 runs, it requests a value. If you enter an integer, the value is assigned to &lt;code&gt;iVar&lt;/code&gt; and displayed. If the input cannot be converted correctly, no value is assigned.&lt;/p&gt;
&lt;p&gt;Production programs rarely use &lt;code&gt;scanf()&lt;/code&gt; for complex input because robust error handling is difficult. They often read text with another standard-input function, inspect the string, and convert it appropriately. This book uses &lt;code&gt;scanf()&lt;/code&gt; to keep introductory examples simple.&lt;/p&gt;

      </description>
      
      <category>C</category>
      
    </item>
    
    <item>
      <title>C Language</title>
      <link>https://www.devkuma.com/en/docs/c/</link>
      <pubDate>Sun, 22 Oct 2017 15:52:10 +0900</pubDate>
      <author>kc@example.com (kc kim)</author>
      <guid>https://www.devkuma.com/en/docs/c/</guid>
      <description>
        
        
        &lt;p&gt;&lt;img src=&#34;https://www.devkuma.com/docs/c/The_C_Programming_Language_logo.jpg&#34; alt=&#34;C Language&#34;&gt;&lt;/p&gt;
&lt;p&gt;This beginner&amp;rsquo;s guide explains the C programming language, which has been used since the 1970s and is still adopted by many software developers and educational institutions.&lt;/p&gt;
&lt;p&gt;The explanations and example code are based on ANSI X3.159-1989, American National Standard for Information Systems - Programming Language - C.&lt;/p&gt;

      </description>
      
      <category>C</category>
      
    </item>
    
    <item>
      <title>C Language | Flow Control</title>
      <link>https://www.devkuma.com/en/docs/c/%ED%9D%90%EB%A6%84-%EC%A0%9C%EC%96%B4/</link>
      <pubDate>Sun, 22 Oct 2017 15:52:10 +0900</pubDate>
      <author>kc@example.com (kc kim)</author>
      <guid>https://www.devkuma.com/en/docs/c/%ED%9D%90%EB%A6%84-%EC%A0%9C%EC%96%B4/</guid>
      <description>
        
        
        
      </description>
      
      <category>C</category>
      
    </item>
    
    <item>
      <title>C Language | Flow Control | do-while Statement</title>
      <link>https://www.devkuma.com/en/docs/c/do~while%EB%AC%B8/</link>
      <pubDate>Sun, 22 Oct 2017 15:52:10 +0900</pubDate>
      <author>kc@example.com (kc kim)</author>
      <guid>https://www.devkuma.com/en/docs/c/do~while%EB%AC%B8/</guid>
      <description>
        
        
        &lt;p&gt;This article explains the &lt;code&gt;do&lt;/code&gt; statement, which checks whether to repeat a statement after executing it. Unlike a &lt;code&gt;while&lt;/code&gt; statement, a &lt;code&gt;do&lt;/code&gt; statement always executes its body at least once regardless of the condition.&lt;/p&gt;
&lt;h2 id=&#34;looping-with-a-delayed-condition-check&#34;&gt;Looping with a Delayed Condition Check&lt;/h2&gt;
&lt;p&gt;A &lt;code&gt;while&lt;/code&gt; statement evaluates its condition before executing the repeated statement and decides whether to continue the loop. In contrast, a &lt;code&gt;do&lt;/code&gt; statement evaluates its condition after executing the statement.&lt;/p&gt;
&lt;h3 id=&#34;do-statement&#34;&gt;do Statement&lt;/h3&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;do statement while (condition);
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Except for executing the repeated statement first, a &lt;code&gt;do&lt;/code&gt; statement is basically the same as a &lt;code&gt;while&lt;/code&gt; statement. Because a &lt;code&gt;while&lt;/code&gt; statement evaluates the condition before running the loop, it skips the body entirely if the first evaluation is false. A &lt;code&gt;do&lt;/code&gt; statement is useful when the body must run at least once regardless of the condition.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Code 1&lt;/strong&gt;&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-c&#34; data-lang=&#34;c&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;#include&lt;/span&gt; &lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;&amp;lt;stdio.h&amp;gt;&lt;/span&gt;&lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;int&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;main&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;()&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;int&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;iCount&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;1&lt;/span&gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;iMax&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#000&#34;&gt;printf&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;반복 횟수를 입력하십시오. &amp;gt;&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;);&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; &lt;span style=&#34;color:#000&#34;&gt;scanf&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;%d&amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;&amp;amp;&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;iMax&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;);&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;do&lt;/span&gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#000&#34;&gt;printf&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;%d번째 루프입니다.&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;iCount&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;++&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;);&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;}&lt;/span&gt; &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;while&lt;/span&gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;iCount&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;&amp;lt;=&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;iMax&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;);&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;return&lt;/span&gt; &lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;0&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Code 1 reads a repetition count and repeats the statement with a &lt;code&gt;do&lt;/code&gt; loop. The major difference from a &lt;code&gt;while&lt;/code&gt; statement is that the body executes once even if &lt;code&gt;iCount &amp;lt;= iMax&lt;/code&gt; is false. Even if the input value is negative or &lt;code&gt;0&lt;/code&gt;, the &lt;code&gt;do&lt;/code&gt; statement executes its body once because it checks the condition afterward.&lt;/p&gt;
&lt;p&gt;Outside of special cases, &lt;code&gt;do&lt;/code&gt; statements are not used often. However, you may encounter one when reading code written by someone else, and some algorithms can be expressed more clearly with a &lt;code&gt;do&lt;/code&gt; statement. It is worth remembering.&lt;/p&gt;

      </description>
      
      <category>C</category>
      
    </item>
    
    <item>
      <title>C Language | Flow Control | Conditional Operator</title>
      <link>https://www.devkuma.com/en/docs/c/%EC%A1%B0%EA%B1%B4-%EC%97%B0%EC%82%B0%EC%9E%90/</link>
      <pubDate>Sun, 22 Oct 2017 15:52:10 +0900</pubDate>
      <author>kc@example.com (kc kim)</author>
      <guid>https://www.devkuma.com/en/docs/c/%EC%A1%B0%EA%B1%B4-%EC%97%B0%EC%82%B0%EC%9E%90/</guid>
      <description>
        
        
        &lt;p&gt;This article explains the conditional operator, which selects an expression according to a condition. Unlike an &lt;code&gt;if&lt;/code&gt; statement, the conditional operator chooses one of two expressions.&lt;/p&gt;
&lt;h2 id=&#34;ternary-operator&#34;&gt;Ternary Operator&lt;/h2&gt;
&lt;p&gt;Most C operators are unary operators with one operand or binary operators with two operands. The conditional operator &lt;code&gt;? :&lt;/code&gt; is a ternary operator with three operands.&lt;/p&gt;
&lt;p&gt;The conditional operator expresses behavior similar to an &lt;code&gt;if&lt;/code&gt; statement in a single expression. It is suitable for small branches. For example, if &lt;code&gt;n&lt;/code&gt; is not &lt;code&gt;0&lt;/code&gt;, assign &lt;code&gt;x&lt;/code&gt; to &lt;code&gt;z&lt;/code&gt;; otherwise, assign &lt;code&gt;y&lt;/code&gt;.&lt;/p&gt;
&lt;h3 id=&#34;conditional-operator&#34;&gt;Conditional Operator&lt;/h3&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;condition ? expression1 : expression2
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;If the condition is true, the operator selects &lt;code&gt;expression1&lt;/code&gt; and returns its value. Otherwise, it selects &lt;code&gt;expression2&lt;/code&gt;. To choose a value to assign to &lt;code&gt;z&lt;/code&gt;, write:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;z = n ? x : y;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;If &lt;code&gt;n&lt;/code&gt; is true, this expression assigns &lt;code&gt;x&lt;/code&gt; to &lt;code&gt;z&lt;/code&gt;. Otherwise, it assigns &lt;code&gt;y&lt;/code&gt;. You can write the same logic with an &lt;code&gt;if-else&lt;/code&gt; statement, but the conditional operator is more concise.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Code 1&lt;/strong&gt;&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;#include &amp;lt;stdio.h&amp;gt;

int main() {
  int iVariable;
  printf(&amp;#34;Please input a number 0 or some else&amp;gt;&amp;#34;);
  scanf(&amp;#34;%d&amp;#34; , &amp;amp;iVariable);
 printf(&amp;#34;An input value is %s.\n&amp;#34; , iVariable ? &amp;#34;True&amp;#34; : &amp;#34;False&amp;#34;);
  return 0;
}
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;This program receives &lt;code&gt;0&lt;/code&gt; or another value from the user and displays whether it is true or false. The expression &lt;code&gt;iVariable ? &amp;quot;True&amp;quot; : &amp;quot;False&amp;quot;&lt;/code&gt; returns &lt;code&gt;&amp;quot;True&amp;quot;&lt;/code&gt; if &lt;code&gt;iVariable&lt;/code&gt; is true and &lt;code&gt;&amp;quot;False&amp;quot;&lt;/code&gt; otherwise. The &lt;code&gt;%s&lt;/code&gt; conversion specifier in &lt;code&gt;printf()&lt;/code&gt; displays the selected string.&lt;/p&gt;

      </description>
      
      <category>C</category>
      
    </item>
    
    <item>
      <title>C Language | Functions</title>
      <link>https://www.devkuma.com/en/docs/c/%ED%95%A8%EC%88%98/</link>
      <pubDate>Sun, 22 Oct 2017 15:52:10 +0900</pubDate>
      <author>kc@example.com (kc kim)</author>
      <guid>https://www.devkuma.com/en/docs/c/%ED%95%A8%EC%88%98/</guid>
      <description>
        
        
        &lt;p&gt;A function implements a specific feature as a separate unit. It is an important concept in structured programming. This section explains how to write and call functions.&lt;/p&gt;

      </description>
      
      <category>C</category>
      
    </item>
    
    <item>
      <title>C Language | Arrays</title>
      <link>https://www.devkuma.com/en/docs/c/%EB%B0%B0%EC%97%B4/</link>
      <pubDate>Sun, 22 Oct 2017 15:52:10 +0900</pubDate>
      <author>kc@example.com (kc kim)</author>
      <guid>https://www.devkuma.com/en/docs/c/%EB%B0%B0%EC%97%B4/</guid>
      <description>
        
        
        &lt;p&gt;An array is a data structure made up of indices and the data corresponding to those indices. This section explains how to declare and use arrays.&lt;/p&gt;

      </description>
      
      <category>C</category>
      
    </item>
    
    <item>
      <title>C Language | Pointers</title>
      <link>https://www.devkuma.com/en/docs/c/%ED%8F%AC%EC%9D%B8%ED%84%B0/</link>
      <pubDate>Sun, 22 Oct 2017 15:52:10 +0900</pubDate>
      <author>kc@example.com (kc kim)</author>
      <guid>https://www.devkuma.com/en/docs/c/%ED%8F%AC%EC%9D%B8%ED%84%B0/</guid>
      <description>
        
        
        &lt;p&gt;Pointers are one of the most powerful features of C and one of the most difficult concepts for learners. This section explains them step by step, starting with the basics.&lt;/p&gt;

      </description>
      
      <category>C</category>
      
    </item>
    
    <item>
      <title>C Language | Pointers | String Pointers</title>
      <link>https://www.devkuma.com/en/docs/c/%EB%AC%B8%EC%9E%90%EC%97%B4-%ED%8F%AC%EC%9D%B8%ED%84%B0/</link>
      <pubDate>Sun, 22 Oct 2017 15:52:10 +0900</pubDate>
      <author>kc@example.com (kc kim)</author>
      <guid>https://www.devkuma.com/en/docs/c/%EB%AC%B8%EC%9E%90%EC%97%B4-%ED%8F%AC%EC%9D%B8%ED%84%B0/</guid>
      <description>
        
        
        &lt;p&gt;This article explains character arrays and pointers to strings. Do not modify a string literal through a pointer. To edit a string based on a literal, copy it into an array.&lt;/p&gt;
&lt;h2 id=&#34;pointers-to-string-literals&#34;&gt;Pointers to String Literals&lt;/h2&gt;
&lt;p&gt;Initializing an array with a string literal stores the string in the array. What happens when a string literal appears in an expression other than an initializer? A string literal evaluates to a pointer to the string.&lt;/p&gt;
&lt;p&gt;For example, &lt;code&gt;printf(&amp;quot;Kitty on your lap&amp;quot;)&lt;/code&gt; passes a value of type &lt;code&gt;char *&lt;/code&gt; to &lt;code&gt;printf()&lt;/code&gt;. Where is that string stored?&lt;/p&gt;
&lt;p&gt;Constants such as string literals and numbers are converted into binary data at compile time and stored in the executable file. When the program runs, the data is loaded into memory as constant values. The specific storage and loading behavior depends on the compiler and system.&lt;/p&gt;
&lt;p&gt;Because a string literal is already stored in memory while a program runs, copying it into another array is useful only when character-level editing is needed. Choose between a pointer to the literal and a copied array according to your purpose.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;char chStr[] = &amp;#34;Kitty on your lap&amp;#34;;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;This statement copies the literal into a new array named &lt;code&gt;chStr&lt;/code&gt;. It is appropriate when you need to edit the resulting array. If you only need a variable that points to the string, copying is unnecessary.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;char *chpStr = &amp;#34;Kitty on your lap&amp;#34;;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;This differs significantly from array initialization. &lt;code&gt;chStr[] = &amp;quot;...&amp;quot;&lt;/code&gt; allocates an array large enough to store the string and copies the literal into it. In contrast, &lt;code&gt;*chpStr = &amp;quot;Kitty on your lap&amp;quot;&lt;/code&gt; assigns the address of a string literal loaded from the executable.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Code 1&lt;/strong&gt;&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;#include &amp;lt;stdio.h&amp;gt;

int main() {
 char *chpStr = &amp;#34;Kitty on your lap&amp;#34;;
 printf(&amp;#34;%s\n&amp;#34; , chpStr);
 return 0;
}
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Code 1 assigns the address of the literal &lt;code&gt;&amp;quot;Kitty on your lap&amp;quot;&lt;/code&gt; to &lt;code&gt;chpStr&lt;/code&gt; and displays the string. Do not modify a string literal through this pointer. Attempting to do so results in undefined behavior.&lt;/p&gt;

      </description>
      
      <category>C</category>
      
    </item>
    
    <item>
      <title>C Language | Pointers | Arrays of Pointers</title>
      <link>https://www.devkuma.com/en/docs/c/%ED%8F%AC%EC%9D%B8%ED%8A%B8-%EB%B0%B0%EC%97%B4/</link>
      <pubDate>Sun, 22 Oct 2017 15:52:10 +0900</pubDate>
      <author>kc@example.com (kc kim)</author>
      <guid>https://www.devkuma.com/en/docs/c/%ED%8F%AC%EC%9D%B8%ED%8A%B8-%EB%B0%B0%EC%97%B4/</guid>
      <description>
        
        
        &lt;p&gt;This article explains how to create an array whose elements are pointers. Arrays of pointers help manage large amounts of data in a structured way.&lt;/p&gt;
&lt;h2 id=&#34;creating-an-array-of-pointers&#34;&gt;Creating an Array of Pointers&lt;/h2&gt;
&lt;p&gt;A pointer is a type of variable that stores a memory address. Like ordinary integer variables, pointers can be stored in arrays. Except that each element is a pointer, an array of pointers works like an ordinary array. The same principles apply to one-dimensional and multidimensional arrays.&lt;/p&gt;
&lt;p&gt;Declare an array of pointers as follows.&lt;/p&gt;
&lt;h3 id=&#34;declaring-an-array-of-pointers&#34;&gt;Declaring an Array of Pointers&lt;/h3&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;type *pointerVariableName[];
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;This syntax lets you manage multiple pointers as an array. Specify an index to retrieve a stored address or access the content at that address. If you understand arrays and pointers, an array of pointer variables is straightforward to use.&lt;/p&gt;
&lt;p&gt;For example, when managing multiple strings like an array, an array of pointers to strings is often more natural than a multidimensional array.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Code 1&lt;/strong&gt;&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;#include &amp;lt;stdio.h&amp;gt;

int main() {
 char *chStr[] = {
   &amp;#34;Blue Blue Glass Moon&amp;#34; ,
    &amp;#34;Under The Crimson Air&amp;#34;
 };

  printf(&amp;#34;%s\n%s\n&amp;#34; , *chStr , *(chStr + 1));
 return 0;
}
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The &lt;code&gt;chStr&lt;/code&gt; array in Code 1 has two elements that store pointers to strings. The elements do not contain the strings themselves. They store only pointers to the strings. Compared with a string table implemented as a two-dimensional array, this representation is flexible because you can update the table simply by changing the referenced addresses.&lt;/p&gt;

      </description>
      
      <category>C</category>
      
    </item>
    
    <item>
      <title>C Language | Pointers | Generic Pointers</title>
      <link>https://www.devkuma.com/en/docs/c/%EB%B2%94%EC%9A%A9-%ED%8F%AC%EC%9D%B8%ED%84%B0/</link>
      <pubDate>Sun, 22 Oct 2017 15:52:10 +0900</pubDate>
      <author>kc@example.com (kc kim)</author>
      <guid>https://www.devkuma.com/en/docs/c/%EB%B2%94%EC%9A%A9-%ED%8F%AC%EC%9D%B8%ED%84%B0/</guid>
      <description>
        
        
        &lt;p&gt;This article introduces &lt;code&gt;void&lt;/code&gt; pointers, which can store pointers of any type. They are useful when passing pointers through functions without depending on a specific type.&lt;/p&gt;
&lt;h2 id=&#34;generic-types&#34;&gt;Generic Types&lt;/h2&gt;
&lt;p&gt;Sometimes a function should receive a pointer without restricting its type. For example, a function may receive or return different pointer types depending on the situation.&lt;/p&gt;
&lt;p&gt;Consider a function that initializes a memory range with a specified value regardless of type. Accepting &lt;code&gt;char *&lt;/code&gt; would work, but callers with other pointer types would need casts.&lt;/p&gt;
&lt;p&gt;The initialization operation does not depend on the data type. A generic pointer is appropriate. A &lt;code&gt;void&lt;/code&gt; pointer can receive any pointer type and can be converted back with a cast.&lt;/p&gt;
&lt;h3 id=&#34;declaring-a-void-pointer&#34;&gt;Declaring a void Pointer&lt;/h3&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;void * variableName
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;A &lt;code&gt;void&lt;/code&gt; pointer can receive a pointer of any type. This makes it possible to write a simple function that receives pointers without depending on their types.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Code 1&lt;/strong&gt;&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-c&#34; data-lang=&#34;c&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;#include&lt;/span&gt; &lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;&amp;lt;stdio.h&amp;gt;&lt;/span&gt;&lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;void&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;FillMemory&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;void&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;*&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;mem&lt;/span&gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;int&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;size&lt;/span&gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;char&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;n&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;int&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;iCount&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;for&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;iCount&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;0&lt;/span&gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;;&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;iCount&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;&amp;lt;&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;size&lt;/span&gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;;&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;iCount&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;++&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;*&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;((&lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;char&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;*&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;mem&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;+&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;iCount&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;n&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;int&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;main&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;()&lt;/span&gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;unsigned&lt;/span&gt; &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;int&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;iCount&lt;/span&gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;iArray&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;[&lt;/span&gt;&lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;8&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;];&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#000&#34;&gt;FillMemory&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;iArray&lt;/span&gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;4&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;*&lt;/span&gt; &lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;8&lt;/span&gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;&lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;0xFF&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;);&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;for&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;iCount&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;0&lt;/span&gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;;&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;iCount&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;&amp;lt;&lt;/span&gt; &lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;8&lt;/span&gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;;&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;iCount&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;++&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;   &lt;span style=&#34;color:#000&#34;&gt;printf&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;iArray[%d] = %X&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;iCount&lt;/span&gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;iArray&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;[&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;iCount&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;]);&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;return&lt;/span&gt; &lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;0&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;code&gt;FillMemory()&lt;/code&gt; receives a pointer to a memory region, its size, and an initialization value. The example creates an eight-element &lt;code&gt;int&lt;/code&gt; array and initializes its 32 bytes to &lt;code&gt;0xFF&lt;/code&gt;, assuming four-byte integers.&lt;/p&gt;
&lt;p&gt;Functions that receive raw memory addresses regardless of type are common. &lt;code&gt;void&lt;/code&gt; pointers support abstractions required by extensible systems.&lt;/p&gt;

      </description>
      
      <category>C</category>
      
    </item>
    
    <item>
      <title>C Language | Pointers | Parameters of the main() Function</title>
      <link>https://www.devkuma.com/en/docs/c/main-%ED%95%A8%EC%88%98%EC%9D%98-%EB%A7%A4%EA%B0%9C-%EB%B3%80%EC%88%98/</link>
      <pubDate>Sun, 22 Oct 2017 15:52:10 +0900</pubDate>
      <author>kc@example.com (kc kim)</author>
      <guid>https://www.devkuma.com/en/docs/c/main-%ED%95%A8%EC%88%98%EC%9D%98-%EB%A7%A4%EA%B0%9C-%EB%B3%80%EC%88%98/</guid>
      <description>
        
        
        &lt;p&gt;This article explains how to retrieve strings passed by a parent process or command when a program starts.&lt;/p&gt;
&lt;h2 id=&#34;command-line-arguments&#34;&gt;Command-Line Arguments&lt;/h2&gt;
&lt;p&gt;The &lt;code&gt;main()&lt;/code&gt; function can receive arguments. Where do they come from? When a parent process starts a program, it can pass options as strings. These values are generally provided from the command line. They let you provide information required to run the program.&lt;/p&gt;
&lt;p&gt;The &lt;code&gt;main()&lt;/code&gt; function receives two arguments. One is the number of command-line arguments. The other is an array of the strings passed as command-line arguments. By convention, the first parameter is named &lt;code&gt;argc&lt;/code&gt; and the second is named &lt;code&gt;argv&lt;/code&gt;. The value of &lt;code&gt;argc&lt;/code&gt; is the argument count, and &lt;code&gt;argv&lt;/code&gt; contains the argument strings. In addition to the form without arguments used so far, a typical &lt;code&gt;main()&lt;/code&gt; function can use the following form.&lt;/p&gt;
&lt;h3 id=&#34;main-function&#34;&gt;main() Function&lt;/h3&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;int main(int argc , char *argv[])
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Use this form when processing command-line arguments. The parameter names are optional, but conventionally &lt;code&gt;argc&lt;/code&gt; abbreviates argument count and &lt;code&gt;argv&lt;/code&gt; abbreviates argument vector. Access the &lt;code&gt;argv&lt;/code&gt; array to retrieve the command string at a given index.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Code 1&lt;/strong&gt;&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-c&#34; data-lang=&#34;c&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;#include&lt;/span&gt;&lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;&amp;lt;stdio.h&amp;gt;&lt;/span&gt;&lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;int&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;main&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;int&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;argc&lt;/span&gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;char&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;*&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;argv&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;[])&lt;/span&gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;int&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;iCount&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;for&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;iCount&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;0&lt;/span&gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;;&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;iCount&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;&amp;lt;&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;argc&lt;/span&gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;;&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;iCount&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;++&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#000&#34;&gt;printf&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;%d번째 인수 = %s&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;iCount&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;+&lt;/span&gt; &lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;1&lt;/span&gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;argv&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;[&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;iCount&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;]);&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;return&lt;/span&gt; &lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;0&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Code 1 displays the arguments passed to &lt;code&gt;main()&lt;/code&gt;. The value of &lt;code&gt;argv[0]&lt;/code&gt; is the name of the executed program. If &lt;code&gt;argc&lt;/code&gt; is greater than &lt;code&gt;1&lt;/code&gt;, command-line arguments were provided.&lt;/p&gt;
&lt;p&gt;Command-line arguments are stored as a table of strings. Check &lt;code&gt;argc&lt;/code&gt; and access the appropriate &lt;code&gt;argv&lt;/code&gt; element to retrieve an argument. The first actual argument is &lt;code&gt;argv[1]&lt;/code&gt;, and the last is &lt;code&gt;argv[argc - 1]&lt;/code&gt;. The standard also guarantees that &lt;code&gt;argv[argc]&lt;/code&gt; is &lt;code&gt;NULL&lt;/code&gt;.&lt;/p&gt;

      </description>
      
      <category>C</category>
      
    </item>
    
    <item>
      <title>C Language | Structure Declarations</title>
      <link>https://www.devkuma.com/en/docs/c/%EA%B5%AC%EC%A1%B0%EC%B2%B4-%EC%84%A0%EC%96%B8/</link>
      <pubDate>Sun, 22 Oct 2017 15:52:10 +0900</pubDate>
      <author>kc@example.com (kc kim)</author>
      <guid>https://www.devkuma.com/en/docs/c/%EA%B5%AC%EC%A1%B0%EC%B2%B4-%EC%84%A0%EC%96%B8/</guid>
      <description>
        
        
        &lt;p&gt;This section explains structures.&lt;/p&gt;

      </description>
      
      <category>C</category>
      
    </item>
    
    <item>
      <title>C Language | Structure Declarations | Automatic Variables - auto</title>
      <link>https://www.devkuma.com/en/docs/c/%EC%9E%90%EB%8F%99-%EB%B3%80%EC%88%98--auto/</link>
      <pubDate>Sun, 22 Oct 2017 15:52:10 +0900</pubDate>
      <author>kc@example.com (kc kim)</author>
      <guid>https://www.devkuma.com/en/docs/c/%EC%9E%90%EB%8F%99-%EB%B3%80%EC%88%98--auto/</guid>
      <description>
        
        
        &lt;p&gt;The &lt;code&gt;auto&lt;/code&gt; keyword explicitly declares a variable as an automatic variable valid only within the block where it is declared. Variables declared inside blocks are automatic by default, so using &lt;code&gt;auto&lt;/code&gt; has little practical meaning in modern C.&lt;/p&gt;
&lt;h2 id=&#34;variables-with-local-lifetimes&#34;&gt;Variables with Local Lifetimes&lt;/h2&gt;
&lt;p&gt;C variable declarations can use storage-class specifiers to define variable lifetimes explicitly. &lt;code&gt;typedef&lt;/code&gt; is technically a storage-class specifier, although it is unusual. Ordinary storage classes determine when variables are released from memory.&lt;/p&gt;
&lt;h3 id=&#34;storage-class-specifier&#34;&gt;Storage-Class Specifier&lt;/h3&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;storage-class-specifier type variable ...
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;You cannot combine multiple storage-class specifiers in one declaration.&lt;/p&gt;
&lt;p&gt;A variable declared inside a block, such as a function body, is an automatic variable. It is valid only within that block. It is initialized when control enters the block and released when control leaves it. The compiler automatically treats variables declared inside blocks as automatic variables.&lt;/p&gt;
&lt;p&gt;You can explicitly declare an automatic variable with &lt;code&gt;auto&lt;/code&gt;. Because this provides no practical advantage, it is generally omitted.&lt;/p&gt;
&lt;h3 id=&#34;auto-storage-class-specifier&#34;&gt;auto Storage-Class Specifier&lt;/h3&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;auto type variableName ...
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The meaning of &lt;code&gt;auto&lt;/code&gt; differs between C and C++. In C++11, &lt;code&gt;auto&lt;/code&gt; indicates type inference. Compiling C code that uses the C meaning of &lt;code&gt;auto&lt;/code&gt; as C++ may therefore cause an error.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Code 1&lt;/strong&gt;&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-c&#34; data-lang=&#34;c&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;#include&lt;/span&gt; &lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;&amp;lt;stdio.h&amp;gt;&lt;/span&gt;&lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;int&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;main&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;()&lt;/span&gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;auto&lt;/span&gt; &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;char&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;*&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;str&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;Kitty on your lap&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; &lt;span style=&#34;color:#000&#34;&gt;printf&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;%s&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;str&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;);&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;return&lt;/span&gt; &lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;0&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The &lt;code&gt;str&lt;/code&gt; variable in Code 1 explicitly uses the &lt;code&gt;auto&lt;/code&gt; storage-class specifier. Omitting &lt;code&gt;auto&lt;/code&gt; makes no difference. Variables declared inside functions are automatic by default.&lt;/p&gt;

      </description>
      
      <category>C</category>
      
    </item>
    
    <item>
      <title>C Language | Structure Declarations | Register Variables - register</title>
      <link>https://www.devkuma.com/en/docs/c/%EB%A0%88%EC%A7%80%EC%8A%A4%ED%84%B0-%EB%B3%80%EC%88%98--register/</link>
      <pubDate>Sun, 22 Oct 2017 15:52:10 +0900</pubDate>
      <author>kc@example.com (kc kim)</author>
      <guid>https://www.devkuma.com/en/docs/c/%EB%A0%88%EC%A7%80%EC%8A%A4%ED%84%B0-%EB%B3%80%EC%88%98--register/</guid>
      <description>
        
        
        &lt;p&gt;Ordinary variables are stored in main memory. A variable declared with &lt;code&gt;register&lt;/code&gt; may be placed in a fast CPU register. The compiler decides whether to use a register in practice.&lt;/p&gt;
&lt;h2 id=&#34;storing-values-in-registers&#34;&gt;Storing Values in Registers&lt;/h2&gt;
&lt;p&gt;Some local variables are accessed frequently. For example, a loop that processes graphics may repeatedly use variables involved in pixel conversion. It is reasonable to store frequently accessed values in faster memory.&lt;/p&gt;
&lt;p&gt;C lets you declare such a variable as a register variable. Registers are fast storage locations inside the CPU.&lt;/p&gt;
&lt;p&gt;Ordinary variables are stored in main memory. Registers can be faster because the CPU does not need to transfer values from main memory before processing them.&lt;/p&gt;
&lt;h3 id=&#34;register-specifier&#34;&gt;register Specifier&lt;/h3&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;register type variableName ...
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Register count and size depend on the physical computer. A compiler may ignore a &lt;code&gt;register&lt;/code&gt; declaration and handle the variable normally if storing it in a register is not appropriate.&lt;/p&gt;
&lt;p&gt;Because register variables are not necessarily stored in main memory, you cannot request their addresses.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Code 1&lt;/strong&gt;&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;#include &amp;lt;stdio.h&amp;gt;

int main() {
 register int i;
 register int k;

 i = 5;
  k = i * 3;

  printf(&amp;#34;i = %d, k = %d\n&amp;#34; , i, k);
 return 0;
}
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;This code declares &lt;code&gt;i&lt;/code&gt; and &lt;code&gt;k&lt;/code&gt; as register variables. Whether they are actually stored in registers depends on the compiler.&lt;/p&gt;
&lt;p&gt;Modern compilers optimize code effectively, so developers rarely need to use the &lt;code&gt;register&lt;/code&gt; specifier today.&lt;/p&gt;

      </description>
      
      <category>C</category>
      
    </item>
    
    <item>
      <title>C Language | Structure Declarations | Static Variables - static</title>
      <link>https://www.devkuma.com/en/docs/c/%EC%A0%95%EC%A0%81-%EB%B3%80%EC%88%98--static/</link>
      <pubDate>Sun, 22 Oct 2017 15:52:10 +0900</pubDate>
      <author>kc@example.com (kc kim)</author>
      <guid>https://www.devkuma.com/en/docs/c/%EC%A0%95%EC%A0%81-%EB%B3%80%EC%88%98--static/</guid>
      <description>
        
        
        &lt;p&gt;Ordinary local variables lose their values when a function finishes. A static variable declared with &lt;code&gt;static&lt;/code&gt; has a permanent lifetime. It is visible only inside its function but retains its value until the application exits, like a global variable.&lt;/p&gt;
&lt;h2 id=&#34;persistent-local-variables&#34;&gt;Persistent Local Variables&lt;/h2&gt;
&lt;p&gt;Variables declared inside a function normally have local lifetimes. They are initialized when the function runs and released when the function returns. This is suitable for temporary storage used during calculations.&lt;/p&gt;
&lt;p&gt;Sometimes a program needs longer-lived state. For example, how can a function track how many times it has been called? Incrementing a dedicated counter inside the function is reliable, but an automatic variable loses its value whenever the function returns.&lt;/p&gt;
&lt;p&gt;A global counter would retain its value, but another function could accidentally change it. A static variable solves this problem. It retains its value until the program exits but remains inaccessible to other functions.&lt;/p&gt;
&lt;h3 id=&#34;static-specifier&#34;&gt;static Specifier&lt;/h3&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;static type variableName ...
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;A variable declared this way has a global lifetime. If declared inside a function, it is not destroyed when the function returns.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Code 1&lt;/strong&gt;&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-c&#34; data-lang=&#34;c&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;#include&lt;/span&gt; &lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;&amp;lt;stdio.h&amp;gt;&lt;/span&gt;&lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;void&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;ShowCount&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;void&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;static&lt;/span&gt; &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;int&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;iCount&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;0&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#000&#34;&gt;printf&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;iCount = %d&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;iCount&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;++&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;);&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;int&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;main&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;()&lt;/span&gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; &lt;span style=&#34;color:#000&#34;&gt;ShowCount&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;();&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#000&#34;&gt;ShowCount&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;();&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#000&#34;&gt;ShowCount&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;();&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;return&lt;/span&gt; &lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;0&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The &lt;code&gt;ShowCount()&lt;/code&gt; function displays how many times it has been called. The static variable &lt;code&gt;iCount&lt;/code&gt; is initialized only once and increments across calls.&lt;/p&gt;
&lt;p&gt;Static variables can also reduce initialization overhead for values that remain constant, such as character arrays containing fixed strings.&lt;/p&gt;

      </description>
      
      <category>C</category>
      
    </item>
    
    <item>
      <title>C Language | Structure Declarations | Storage Classes for Functions</title>
      <link>https://www.devkuma.com/en/docs/c/%ED%95%A8%EC%88%98%EC%9D%98-%EA%B8%B0%EC%96%B5-%ED%81%B4%EB%9E%98%EC%8A%A4/</link>
      <pubDate>Sun, 22 Oct 2017 15:52:10 +0900</pubDate>
      <author>kc@example.com (kc kim)</author>
      <guid>https://www.devkuma.com/en/docs/c/%ED%95%A8%EC%88%98%EC%9D%98-%EA%B8%B0%EC%96%B5-%ED%81%B4%EB%9E%98%EC%8A%A4/</guid>
      <description>
        
        
        &lt;p&gt;Function declarations can use the &lt;code&gt;extern&lt;/code&gt; and &lt;code&gt;static&lt;/code&gt; specifiers to define storage classes. To hide a function so that other source files cannot call it, declare the function with &lt;code&gt;static&lt;/code&gt;.&lt;/p&gt;
&lt;h2 id=&#34;function-visibility&#34;&gt;Function Visibility&lt;/h2&gt;
&lt;p&gt;Unlike variables, functions do not have an inner scope level. A function has global duration and can be referenced anywhere in the same file. As explained in the article about function declarations, a prototype declaration is required before calling a function.&lt;/p&gt;
&lt;p&gt;When compiling multiple files together, function names can conflict just like variable names. Functions therefore also have storage classes. A function can use either &lt;code&gt;static&lt;/code&gt; or &lt;code&gt;extern&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;A function with the &lt;code&gt;static&lt;/code&gt; storage class can be called only from the file where it is defined. Functions in other files cannot call it. In contrast, an &lt;code&gt;extern&lt;/code&gt; function can be called from other files. If you omit the storage class, &lt;code&gt;extern&lt;/code&gt; is implied.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Code 1&lt;/strong&gt;&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-c&#34; data-lang=&#34;c&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;#include&lt;/span&gt; &lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;&amp;lt;stdio.h&amp;gt;&lt;/span&gt;&lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;void&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;Function1&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;void&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;);&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;void&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;Function2&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;void&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;);&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;int&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;main&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;()&lt;/span&gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; &lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;/*Function1();  /*error*/&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; &lt;span style=&#34;color:#000&#34;&gt;Function2&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;();&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;return&lt;/span&gt; &lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;0&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;strong&gt;Code 2&lt;/strong&gt;&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-c&#34; data-lang=&#34;c&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;static&lt;/span&gt; &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;void&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;Function1&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;()&lt;/span&gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;{}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;extern&lt;/span&gt; &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;void&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;Function2&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;()&lt;/span&gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;{}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;If you compile Code 1 and Code 2 together, &lt;code&gt;main()&lt;/code&gt; can call &lt;code&gt;Function2()&lt;/code&gt; but cannot call &lt;code&gt;Function1()&lt;/code&gt; because it is not visible from Code 1. Uncommenting the &lt;code&gt;Function1()&lt;/code&gt; call causes an error. The &lt;code&gt;static&lt;/code&gt; storage class hides &lt;code&gt;Function1()&lt;/code&gt; from external files.&lt;/p&gt;
&lt;p&gt;This is useful for a function specialized for a particular process in one file. Assign the &lt;code&gt;static&lt;/code&gt; storage class to a function with low independence to avoid name conflicts.&lt;/p&gt;

      </description>
      
      <category>C</category>
      
    </item>
    
    <item>
      <title>C Language | Preprocessing</title>
      <link>https://www.devkuma.com/en/docs/c/%EC%A0%84%EC%B2%98%EB%A6%AC-preprocess/</link>
      <pubDate>Sun, 22 Oct 2017 15:52:10 +0900</pubDate>
      <author>kc@example.com (kc kim)</author>
      <guid>https://www.devkuma.com/en/docs/c/%EC%A0%84%EC%B2%98%EB%A6%AC-preprocess/</guid>
      <description>
        
        
        &lt;p&gt;Preprocessor directives specify how to process source code before compilation.&lt;/p&gt;

      </description>
      
      <category>C</category>
      
    </item>
    
    <item>
      <title>C Language | Preprocessing | Include - #include</title>
      <link>https://www.devkuma.com/en/docs/c/include/</link>
      <pubDate>Sun, 22 Oct 2017 15:52:10 +0900</pubDate>
      <author>kc@example.com (kc kim)</author>
      <guid>https://www.devkuma.com/en/docs/c/include/</guid>
      <description>
        
        
        &lt;p&gt;The &lt;code&gt;#include&lt;/code&gt; preprocessor directive, which is processed before compilation, can include header files containing declarations and other shared definitions in every source file. This operation is called an include.&lt;/p&gt;
&lt;h2 id=&#34;creating-a-header-file&#34;&gt;Creating a Header File&lt;/h2&gt;
&lt;p&gt;In medium-sized and larger development projects consisting of multiple files, file organization is as important as programming techniques. A small test program like the ones used here can fit in a single file, but real projects cannot. Development teams often work concurrently on separate areas, such as graphics and audio, which cannot reasonably be managed in one file.&lt;/p&gt;
&lt;p&gt;When logically separated features are developed in separate files, those files must eventually be brought together for compilation. By convention, the source file containing the &lt;code&gt;main()&lt;/code&gt; function and used to create an executable has a &lt;code&gt;*.c&lt;/code&gt; extension. Other files that provide library declarations and feature sets are header files with a &lt;code&gt;*.h&lt;/code&gt; extension. Header files are inserted before the &lt;code&gt;main()&lt;/code&gt; function.&lt;/p&gt;
&lt;p&gt;To compile multiple files together, use the &lt;code&gt;#include&lt;/code&gt; preprocessor directive to tell the compiler to insert a header file at a specified location. When the compiler encounters &lt;code&gt;#include&lt;/code&gt;, it inserts the specified file at that point. Until now, examples such as &lt;code&gt;#include &amp;lt;stdio.h&amp;gt;&lt;/code&gt; have included library files provided with C. This operation is called including a file.&lt;/p&gt;
&lt;p&gt;For files other than standard headers, write the filename inside double quotation marks, as in &lt;code&gt;#include &amp;quot;filename&amp;quot;&lt;/code&gt;. This was explained in &lt;a href=&#34;https://www.devkuma.com/books/pages/862&#34;&gt;Your First C Program&lt;/a&gt;. Consult your compiler documentation for details about how files are searched. A filename enclosed in double quotation marks is usually searched for in the same directory as the &lt;code&gt;*.c&lt;/code&gt; file.&lt;/p&gt;
&lt;p&gt;An include can be understood as a simple file insertion. Commands beginning with &lt;code&gt;#&lt;/code&gt; are instructions for the preprocessor, not the compiler. Preprocessing runs before source code is compiled. Because &lt;code&gt;#include&lt;/code&gt; inserts a file, the contents of the specified file are inserted as-is before the compiler processes the source code. Developers can place declarations for common functions in a header file and include it in the project&amp;rsquo;s C source files. This avoids writing the same declarations repeatedly.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Code 1&lt;/strong&gt;&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-c&#34; data-lang=&#34;c&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;/* sample.h */&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;int&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;strlen&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;const&lt;/span&gt; &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;char&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;*&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;str&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;);&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;strong&gt;Code 2&lt;/strong&gt;&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-c&#34; data-lang=&#34;c&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;int&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;strlen&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;const&lt;/span&gt; &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;char&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;*&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;str&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;int&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;count&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;for&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;count&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;0&lt;/span&gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;;&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;*&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;str&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;+&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;count&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;;&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;count&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;++&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;);&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;return&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;count&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;strong&gt;Code 3&lt;/strong&gt;&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-c&#34; data-lang=&#34;c&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;#include&lt;/span&gt; &lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;&amp;lt;stdio.h&amp;gt;&lt;/span&gt;&lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;#include&lt;/span&gt; &lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;&amp;#34;sample.h&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;int&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;main&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;()&lt;/span&gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;char&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;*&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;str&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;Kitty on your lap&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#000&#34;&gt;printf&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;%s length=%d&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;str&lt;/span&gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;strlen&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;str&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;));&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;return&lt;/span&gt; &lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;0&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Create the header file shown in Code 1, include it in Code 3, and compile the program. The contents of the header file are copied to the location of &lt;code&gt;#include &amp;quot;sample.h&amp;quot;&lt;/code&gt; before compilation. Code 1 declares the &lt;code&gt;strlen()&lt;/code&gt; function, which returns the number of characters in a string excluding the null character. The implementation of &lt;code&gt;strlen()&lt;/code&gt; is written in Code 2. Once created, a header file like this can be reused across development projects.&lt;/p&gt;

      </description>
      
      <category>C</category>
      
    </item>
    
    <item>
      <title>C Language | Preprocessing | Stringification</title>
      <link>https://www.devkuma.com/en/docs/c/%EB%AC%B8%EC%9E%90%EC%97%B4%ED%99%94/</link>
      <pubDate>Sun, 22 Oct 2017 15:52:10 +0900</pubDate>
      <author>kc@example.com (kc kim)</author>
      <guid>https://www.devkuma.com/en/docs/c/%EB%AC%B8%EC%9E%90%EC%97%B4%ED%99%94/</guid>
      <description>
        
        
        &lt;p&gt;This article explains how to convert code passed to a function-like macro into a string. It lets you pass non-string text to a macro and convert it into a string during expansion.&lt;/p&gt;
&lt;h2 id=&#34;function-like-macros-and-the-stringification-operator&#34;&gt;Function-Like Macros and the Stringification Operator&lt;/h2&gt;
&lt;p&gt;A preprocessing operator available in function-like macros converts a sequence of tokens received as a parameter into a string. It analyzes the tokens and expands them with quotation marks. This makes it possible to create macros that automatically convert numbers and token sequences into strings.&lt;/p&gt;
&lt;p&gt;To stringify a token sequence, place the &lt;code&gt;#&lt;/code&gt; operator before a macro parameter.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;#define TOSTRING(param) #param
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Because this is a macro, the token sequence passed to &lt;code&gt;param&lt;/code&gt; is not restricted. The &lt;code&gt;#&lt;/code&gt; operator stringifies any token sequence.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;TOSTRING(1234) → &amp;#34;1234&amp;#34;

TOSTRING(int iValue = 10\n) → &amp;#34;int iValue = 10\\n&amp;#34;

TOSTRING(&amp;#34;Kitty&amp;#34;) → &amp;#34;\&amp;#34;Kitty\&amp;#34;&amp;#34;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;This conversion occurs at the source-text level before compilation, not dynamically while the program runs. The stringification operator converts quotation marks into &lt;code&gt;\&amp;quot;&lt;/code&gt; and backslashes into &lt;code&gt;\\&lt;/code&gt;, preserving the original tokens in string form.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Code 1&lt;/strong&gt;&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-c&#34; data-lang=&#34;c&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;#include&lt;/span&gt; &lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;&amp;lt;stdio.h&amp;gt;&lt;/span&gt;&lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;#define PRINTLN(string) printf(#string &amp;#34;\n&amp;#34;)
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;int&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;main&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;()&lt;/span&gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#000&#34;&gt;PRINTLN&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;0xFF&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;);&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#000&#34;&gt;PRINTLN&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;Kitty&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;on&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;your&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;lap&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;);&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; &lt;span style=&#34;color:#000&#34;&gt;PRINTLN&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;Kernighan&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;and&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;Ritchie&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;wrote&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;hello, world&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;on&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;their&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;book&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;.);&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;return&lt;/span&gt; &lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;0&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The &lt;code&gt;PRINTLN()&lt;/code&gt; macro in Code 1 stringifies its argument and displays it with &lt;code&gt;printf()&lt;/code&gt;. The last example includes the token &lt;code&gt;&amp;quot;hello, world\n&amp;quot;&lt;/code&gt;, which the preprocessor converts to &lt;code&gt;\&amp;quot;hello, world\\n\&amp;quot;&lt;/code&gt;. The quotation marks and escape sequence are therefore displayed literally.&lt;/p&gt;

      </description>
      
      <category>C</category>
      
    </item>
    
    <item>
      <title>C Language | Preprocessing | Token Pasting ##</title>
      <link>https://www.devkuma.com/en/docs/c/%ED%86%A0%ED%81%B0-%EC%97%B0%EA%B2%B0/</link>
      <pubDate>Sun, 22 Oct 2017 15:52:10 +0900</pubDate>
      <author>kc@example.com (kc kim)</author>
      <guid>https://www.devkuma.com/en/docs/c/%ED%86%A0%ED%81%B0-%EC%97%B0%EA%B2%B0/</guid>
      <description>
        
        
        &lt;p&gt;This article explains the &lt;code&gt;##&lt;/code&gt; operator, which combines arbitrary tokens. It is mainly used to join a parameter passed to a macro with another macro or value.&lt;/p&gt;
&lt;h2 id=&#34;token-pasting-operator&#34;&gt;Token-Pasting Operator&lt;/h2&gt;
&lt;p&gt;In addition to the stringification operator, macros defined with &lt;code&gt;#define&lt;/code&gt; support another important preprocessing operator: &lt;code&gt;##&lt;/code&gt;, the token-pasting operator. It can be used in ordinary and function-like macros.&lt;/p&gt;
&lt;h3 id=&#34;-operator&#34;&gt;&lt;code&gt;##&lt;/code&gt; Operator&lt;/h3&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;token1 ## token2
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The token-pasting operator joins the token on its left with the token on its right. This happens at the source level during preprocessing, not dynamically while the program runs. For example, &lt;code&gt;WIN ## 32&lt;/code&gt; becomes &lt;code&gt;WIN32&lt;/code&gt;, and &lt;code&gt;WIN ## 16&lt;/code&gt; becomes &lt;code&gt;WIN16&lt;/code&gt;.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-c&#34; data-lang=&#34;c&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;#define INT16 short
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;#define INT32 int
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;#define INT(n) INT ## n
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The &lt;code&gt;INT()&lt;/code&gt; macro joins the token &lt;code&gt;INT&lt;/code&gt; with the parameter &lt;code&gt;n&lt;/code&gt;. For example, &lt;code&gt;INT(16)&lt;/code&gt; expands to &lt;code&gt;INT16&lt;/code&gt;, which then expands to &lt;code&gt;short&lt;/code&gt;.&lt;/p&gt;
&lt;h3 id=&#34;code&#34;&gt;Code&lt;/h3&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-c&#34; data-lang=&#34;c&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;#include&lt;/span&gt; &lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;&amp;lt;stdio.h&amp;gt;&lt;/span&gt;&lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;#define TOKEN0 &amp;#34;Kitty&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;#define TOKEN1 &amp;#34;Kitten&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;#define TOKEN(n) TOKEN ## n
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;int&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;main&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;()&lt;/span&gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#000&#34;&gt;printf&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;%s&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;TOKEN&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;0&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;));&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; &lt;span style=&#34;color:#000&#34;&gt;printf&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;%s&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;TOKEN&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;1&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;));&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;return&lt;/span&gt; &lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;0&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The &lt;code&gt;TOKEN()&lt;/code&gt; macro receives a token suffix. For example, &lt;code&gt;TOKEN(0)&lt;/code&gt; joins &lt;code&gt;TOKEN&lt;/code&gt; and &lt;code&gt;0&lt;/code&gt;, producing &lt;code&gt;TOKEN0&lt;/code&gt;. Because &lt;code&gt;TOKEN0&lt;/code&gt; is defined with &lt;code&gt;#define&lt;/code&gt;, it expands to &lt;code&gt;&amp;quot;Kitty&amp;quot;&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;A new token created with &lt;code&gt;##&lt;/code&gt; must be valid. An invalid token causes a compile error. Remember that token pasting is source-level expansion performed before compilation.&lt;/p&gt;

      </description>
      
      <category>C</category>
      
    </item>
    
    <item>
      <title>C Language | Advanced Features</title>
      <link>https://www.devkuma.com/en/docs/c/%EA%B3%A0%EA%B8%89-%EA%B8%B0%EB%8A%A5/</link>
      <pubDate>Sun, 22 Oct 2017 15:52:10 +0900</pubDate>
      <author>kc@example.com (kc kim)</author>
      <guid>https://www.devkuma.com/en/docs/c/%EA%B3%A0%EA%B8%89-%EA%B8%B0%EB%8A%A5/</guid>
      <description>
        
        
        
      </description>
      
      <category>C</category>
      
    </item>
    
  </channel>
</rss>
