<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Topics tagged with c programming]]></title><description><![CDATA[A list of topics that have been tagged with c programming]]></description><link>https://lankadevelopers.lk/tags/c programming</link><generator>RSS for Node</generator><lastBuildDate>Sat, 18 Apr 2026 07:24:28 GMT</lastBuildDate><atom:link href="https://lankadevelopers.lk/tags/c programming.rss" rel="self" type="application/rss+xml"/><pubDate>Invalid Date</pubDate><ttl>60</ttl><item><title><![CDATA[How to make pattern programs in C or C++]]></title><description><![CDATA[<p dir="auto">Most of the pattern programs written in C or C++ are the same, but different in syntax. This is done so that you can have a pattern program, which can be reused and saved in a library. By doing so, you don't have to type the bunch of code over and over again again, and it is a lot faster than writing a new program each time.</p>
<p dir="auto">Read this article, as they have shown the <a href="https://www.techgeekbuzz.com/pattern-programs-in-c/" target="_blank" rel="noopener noreferrer nofollow ugc">most asked pattern programs in C</a>.</p>
]]></description><link>https://lankadevelopers.lk/topic/904/how-to-make-pattern-programs-in-c-or-c</link><guid isPermaLink="true">https://lankadevelopers.lk/topic/904/how-to-make-pattern-programs-in-c-or-c</guid><dc:creator><![CDATA[Saba Techatom]]></dc:creator><pubDate>Invalid Date</pubDate></item><item><title><![CDATA[C Programming මුල සිට ඉගෙනගනිමු (part 16 - C functions)]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://lankadevelopers.lk/uid/1206">@Kalana</a><br />
Elama api balan innawa</p>
]]></description><link>https://lankadevelopers.lk/topic/493/c-programming-ම-ල-ස-ට-ඉග-නගන-ම-part-16-c-functions</link><guid isPermaLink="true">https://lankadevelopers.lk/topic/493/c-programming-ම-ල-ස-ට-ඉග-නගන-ම-part-16-c-functions</guid><dc:creator><![CDATA[root]]></dc:creator><pubDate>Invalid Date</pubDate></item><item><title><![CDATA[C Programming මුල සිට ඉගෙනගනිමු (part 15 - Strings Q&amp;A)]]></title><description><![CDATA[<p dir="auto">සුබ දවසක් වේවා ඔයාලට. මන් කලින් ලිපියේ Strings ගැන සියල්ලම වගෙ කතා කලා. ඒත් ඒවා යොදාගෙන අපිට විසඳන්න පුලුවන් ගැටළු ගැන සාකච්ජා කලේ නෑ. අපි මේ ලිපියෙන් කරන්න යන්නේ Strings වලින් අපෙන් අහන ප්‍රශ්න හා ඒවාට පිලිතුරු ගැනයි. මන් සෑම ගැටළුවක්ම කොටස් වලට  කඩ කඩ අහන්නම්.</p>
<p dir="auto"><strong>Question 1</strong><br />
<strong>1. Write a C program to input string from the keyboard and display it on screen.</strong></p>
<p dir="auto">ඉහත ගැටළුවනම් සරල එකක් බව ඔබට පෙනෙනවා ඇති වචනයක් හෝ වචන කිහිපයක් keyboard එක මඟින් input කරලා ඒ input කරපු එක screen එකේ display කරන්න කියලයි මේකෙන් කියන්නේ.</p>
<p dir="auto">මෙම ගැටලුව විසඳීමට නම් අපට මේ කරුණු වැදගත් වෙනවා.</p>
<ul>
<li>
<p dir="auto"><code>chr</code> එසේත් නැතිනම් character කිහිපයක් එකතු වෙලා තමා string එකක් හැදෙන්නේ. ඒ නිසා මෙම character කිහිපය එකට එකතු කිරීමට අපිට array එකක් යොදා ගැනීමට සිදු වනවා.</p>
</li>
<li>
<p dir="auto">string එකක භාවිතා කරන විට අපිට <code>#include &lt;stdio.h&gt;</code> එකට අමතරව <code>#include &lt;string.h&gt;</code> එකත් භාවිතා කිරීමට සිදු වනවා.</p>
</li>
<li>
<p dir="auto"><code>scanf</code> එකක් භාවිතා කර string එකක් keyboard එක මඟින් input කරන විට එම string එක read කිරීමට %c වෙනුවට %s භාවිතා කිරීමට සිදු වනවා.</p>
</li>
<li>
<p dir="auto"><code>scanf</code> එකක් භාවිතා කරන විට variable එක ඉස්සරහින් <code>&amp;</code> ලකුණ යෙදීමෙනුත් අපි වලකිනවා.</p>
</li>
</ul>
<p dir="auto">අපි දැන් මේ කරුණු සැලකිල්ලට ගනිමින් program එක code කරලා බලමු.</p>
<pre><code>#include &lt;stdio.h&gt;
#include &lt;string.h&gt; // string header එක භාවිතා කල යුතු වේ.

int main()
{
    char words[100]; // ඔබට input කිරීමට අවශ්‍ය වන අකුරු ගණන දල වශයෙන් මෙතන සංඛ්‍යාත්මකව දැක්විය යුතුය.

    printf("Enter a string = ");
    scanf("%s", words); // අනික් ඒවා මෙන් නොව මෙහිදී &amp; ලකුණ යෙදිය යුතු නොවේ. තවද %c වෙනුවට %s භාවිතා කරයි.

    printf("You have entered = %s", words); //string එකක් input කිරීමට හා output කිරීමට %s යොදා ගනී

    return 0;
}
</code></pre>
<p dir="auto"><strong>Output -:</strong></p>
<pre><code>Enter a string = Kalana
Your have entered = Kalana
</code></pre>
<p dir="auto">අපි දැන් පලමුවන ගැටලුව කලා. දැන් අපි ඒ ගැටලුවටම තව කොටසක් සම්බන්ධ කරල බලමු ඒක විසඳන විදිහ.</p>
<p dir="auto"><strong>2. Improve above program to get length of that string and output the value of length.</strong></p>
<p dir="auto">ඉහත කොටසින් කියන්නේ අපි කලින් හදපු program එක වැඩිදියුනු කරන්න කියලා. ඒ තමයි අපි input කරපු string එකේ දිග සොයාගැනීමයි. <code>char words[100];</code> මඟින් අපි දළ දිගක් ලබා දුන්නට අපි දන්නෑ අපි input කරපු string එකේ සැබෑ දිග කීයද කියලා මන් Kalana කියලා ටයිප් කලොත් ඒකේ අකුරු ගනන 6යි. එතකොට ඒකේ සැබෑ දිගත් 6යි 100 නෙමේ. එම නිසා අපි string එකක සැබෑ දිග අරගන්න හදන විට මේ දේවල් අනුගමනය කල යුතු වනවා.</p>
<ul>
<li>string එකක දිග සංඛ්‍යාත්මකව ලබා ගැනීම සඳහා <code>#include &lt;string.h&gt;</code> මඟින් අපට ලබා දී ඇති විශේෂිත අංගය වන්නේ <code>strlen()</code> keyword එකයි.</li>
</ul>
<pre><code>#include &lt;stdio.h&gt;
#include &lt;string.h&gt; 

int main()
{
    char words[100]; 
    int length = 0; //length එක keyboard එක මඟින් input නොකරන නිසා 0ට සමාන කිරීම.

    printf("Enter a string = ");
    scanf("%s", words); 
    
    length = strlen(words); //string එකක දිග සංඛ්‍යාත්මකව ලබා ගැනීම සඳහා strlen() keyword එක භාවිතා කිරීම

    printf("\nYou have entered = %s", words); 
    printf("\nYour string length is = %d", length); //string එකේ දිග output කිරීම.

    return 0;
}
</code></pre>
<p dir="auto"><strong>Output -:</strong></p>
<pre><code>Enter a string = kalana

You have entered = kalana
Your string length is = 6
</code></pre>
<p dir="auto">ඉහත 6 මඟින් පෙන්නුම් කරන්නේ එක එක අකුර array එකක් තුල store වෙලා ඇති කාමර ප්‍රමාණයයි. අපි එය මේ විදිහට පැහැදිලි කරගම්මු. මන් කිව්වා array එකක් සෑම විටම පටන් ගන්නේ 0න් කියලා.</p>
<ul>
<li>අපි input කරපු වචනය තමා kalana කියන්නේ. එය array එක තුල store වන්නේ මේ ආකාරයටයි.</li>
</ul>
<pre><code>words[0] = 'k'
words[1] = 'a'
words[2] = 'l'
words[3] = 'a'
words[4] = 'n'
words[5] = 'a'
words[6] සිට words[100] දක්වා අපි කිසිවක් input කර නොමැති හෙයින් ඒවා තිබෙන විදිහටම නිශ්ක්‍රීයව පවතී.
</code></pre>
<p dir="auto"><strong>3. improve above program to revers a string that you have entered from keyboard.</strong></p>
<p dir="auto">මෙහිදී කියන්නේ අපි ඇතුලත් කරන ඕනෑම string එකක් පැති මාරු කරලා එසේත් නැත්තම් අනිත් පැත්තට ලියන්න කියලා. උදාහරණයක් ගත්තොත් අපි input කලොත් <code>cat</code> කියලා ඒක output  වෙන්න ඕනේ <code>tac</code> කියලා.</p>
<p dir="auto">කලින් කොටසේ අපි දැනගත්තා string එකක් array එකක් තුල store වෙන ආකාරය. එහිදී kalana කියන නම් array එකේ 0 සිට 5 දක්වා අකුරින් අකුර store උනා. නමුත් අපි එම string එක  output කරද්දි ඒ ඉලක්කම් පිලිවෙළට output කලා.</p>
<pre><code>words[0] = 'k'
words[1] = 'a'
words[2] = 'l'
words[3] = 'a'
words[4] = 'n'
words[5] = 'a'

Output = kalana
</code></pre>
<p dir="auto">නමුත් අපි 5 සිට 0 දක්වා පිලිවෙලට array එක සෑදුවොත් මොකද වෙන්නේ</p>
<pre><code>words[5] = 'a'
words[4] = 'n'
words[3] = 'a'
words[2] = 'l'
words[1] = 'a'
words[0] = 'k'

Output = analak
</code></pre>
<p dir="auto">දැන් ඔබට පෙනෙනව ඇති 0 සිට 5ට නොව 5 සිට 0ට array එකේ ඉලක්කම් වෙනස් කලොත් අපිට අපේ string එක අනිත් පැත්ත හරවන්න පුලුවන් කියලා.</p>
<pre><code>#include &lt;stdio.h&gt;
#include &lt;string.h&gt; 

int main()
{
    char words[100]; 
    int length = 0;

    printf("Enter a string = ");
    scanf("%s", words); 
    
    length = strlen(words);

    printf("\nYou have entered = %s", words); 
    printf("\nYour string length is = %d", length);
    printf("\nReversed string is = ");
	
	length = length - 1; // array එකක් පටන් ගන්නේ 0සිට නිසා අකුරු 6 බිංදුවේ සිට පටන් ගත්තොත් ඉවර වන්නේ 5න් වේ.
    
    while(length &gt;= 0) // අපි input කරපු වචනයේ දිග 0ට වඩා විශාල හෝ සමානදැයි බැලීම
    {
        printf("%c", words[length]); // අපි input කරපු වචනයේ අවසන් අකුර output වීම
        length--;             // ඊලග අකුර output කිරීම සඳහා අපි input කරපු වචනයේ දිග එකකින් අඩු කිරීම.
    }

    return 0;
}
</code></pre>
<p dir="auto"><strong>Output -:</strong></p>
<pre><code>Enter a string = kalana

You have entered = kalana
Your string length is = 6
Reversed string is = analak
</code></pre>
<p dir="auto">අපි ඉහත code එක පියවර ආකාරයෙන් බලමු.</p>
<ul>
<li>
<p dir="auto">මන් input කල වචනය වන්නේ kalana යන්නයි.</p>
</li>
<li>
<p dir="auto">එහි දිග 6ක් බව <code>strlen()</code> මඟින් අපි සොයා ගත්තා.</p>
</li>
<li>
<p dir="auto"><code>length = length - 1;</code> මඟින් අපි 6 කියන ඉලක්කම 5 දක්වා අඩු කලා.</p>
</li>
<li>
<p dir="auto"><strong>while loop එකේ පලමු වටය</strong></p>
</li>
</ul>
<pre><code>//  length = length - 1; නිසා දැන් length වල නවතම අගය 5 වේ.

while(length &gt;= 0) // 5 &gt;= 0 බව සත්‍ය නිසා  while loop එක run වේ.
{
    printf("%c", words[length]); //  length = 5 නිසා words[5] හි අගය output වේ. words[5] හි අගය වන්නේ  `a` අකුරයි.
    length--;       // 4වන අකුර output කිරීම සඳහා අපි 5 කියන අගය එකකින් අඩු කිරීම සිදු කරයි. 
}
</code></pre>
<pre><code>Output -: a
</code></pre>
<ul>
<li><strong>while loop එකේ දෙවන වටය</strong></li>
</ul>
<pre><code>// length--; නිසා දැන් length වල නවතම අගය 4 වේ.

while(length &gt;= 0) // 4 &gt;= 0 බව සත්‍ය නිසා  while loop එක run වේ.
{
    printf("%c", words[length]); // length = 4 නිසා words[4] හි අගය output වේ. words[5] හි අගය වන්නේ  `n` අකුරයි.
    length--;       // 3වන අකුර output කිරීම සඳහා අපි 4 කියන අගය එකකින් අඩු කිරීම සිදු කරයි. 
}
</code></pre>
<pre><code>Output -: an
</code></pre>
<ul>
<li>මෙලෙස length 0වීම දක්වා while loop එක run වී අපගේ වචනය අනිත් පැත්ත හරවා අපිට ලබා දේ.</li>
</ul>
<p dir="auto">පලමු ප්‍රශ්නය මෙතනින් අවසන්. දැන් අපි තව ප්‍රශ්නයක් බලමු.</p>
<hr />
<p dir="auto"><strong>Question 2</strong></p>
<p dir="auto"><strong>1. Write a C program to input string from keyboard and convert lower case into uppercase.</strong></p>
<pre><code>Hint : ‘a’ – 97, ‘z’ - 122
       ‘A’ – 65, ‘Z’ - 90
</code></pre>
<p dir="auto">මෙම ප්‍රශ්නයෙන් කියන්නේ අපි ඕනෑම වාක්‍යක් input කල විට එහි ඇති සියලුම simple letters අපිට හරවන්න කියනවා capital letters බවට. අපිට ඉඟියකුත් මෙහිදී දීලා තියෙනවා ASCII code වල ඉංග්‍රීසි අකුරු වල සංඛ්‍යාත්මක නිරූපණය. අපිට ලබා දීලා තියෙනවා.</p>
<ul>
<li>මෙහි දී ඇති ආකාරයට අපි ඇතුලත් කරන වාක්‍යයක simple letters හඳුනාගත යුතු වනවා. ඒ සඳහා ඔබට පෙනෙනවා ඇති අපිට අකුරින් අකුර පරීක්ෂා කිරීමට සිදු වන බව. වාක්‍යයක් අකුරින් අකුර පරීක්ෂා කිරීමට නම් පලමුව එම වාක්‍යයේ දිග හදුනාගත යුතුයි. ඉන්පසුව එය අකුරින් අකුර පරීක්ෂා කර බැලිය යුතුයි. එම කාර්යයන් සදහා අපට <code>strlen()</code> උපයෝගී කරගත හැකිය.</li>
</ul>
<pre><code># include &lt;stdio.h&gt;
# include &lt;string.h&gt;

int main (void)
{
	char word[100];
	int i = 0;

	printf("Enter a string = ");
	scanf("%s", word); // string එකක් input කිරීම

	while((strlen(word) - 1) &gt;= i) // strlen(word) මගින් string එකේ දිග සංඛ්‍යාත්මකව ගෙන එය 0ට වඩා විශාලදැයි බැලීම. මෙහි i වල අගය 0ට සමාන වේ.
	{
	    printf("%c", word[i]); // 0 සිට string එකේ සංඛ්‍යාත්මක දිගේ අවසානය දක්වා ගොස් අකුරින් අකුර output කිරීම.
		i++; //i වල අගය එකකින් වැඩි කිරීම.
	}
	
	return 0;
}
</code></pre>
<p dir="auto"><strong>Output -:</strong></p>
<pre><code>Enter a string = kalana
kalana
</code></pre>
<ul>
<li>
<p dir="auto"><code>strlen(word) - 1</code> භාවිතා කලේ array එකක් සෑම විටම පටන්ගන්නේ 0නි. එමනිසා 0 සිට පටන් ගත්තොත් අවසාන අගයෙන් එකක් අඩු වේ.</p>
</li>
<li>
<p dir="auto">අපි දැන් මීලඟට බලමු simple හා capital අකුරු වල සංක්‍යාත්මක අගයයන් එනම් ASCII අගයයන්</p>
</li>
</ul>
<pre><code># include &lt;stdio.h&gt;
# include &lt;string.h&gt;

int main (void)
{
	char word[100];
	int i = 0;

	printf("Enter a string = ");
	scanf("%s", word);

	while(strlen(word) &gt;= i)
	{
	    printf("%c  ", word[i]);
		printf("%d\n", word[i]); //අපි ඇතුලත් කරන ඉංග්‍රීසි අකුරේ ASCII අගය output කරයි.
		i++;
	}
	
	return 0;
}
</code></pre>
<p dir="auto"><strong>Output -:</strong></p>
<pre><code>Enter a string = AaZz
A  65
a  97
Z  90
z  122
</code></pre>
<ul>
<li>පහත වගුව බලා ASCII රටාව තේරුම් ගනිමු.</li>
</ul>
<pre><code>a = 97       y = 121
A = 65       Y =  89
වෙනස 32   වෙනස 32

b = 98       z = 122
B = 66       Z =  90
වෙනස 32   වෙනස 32
</code></pre>
<ul>
<li>
<p dir="auto">simple වල ASCII අගය පරාසය  97 හා 122 අතර වේ.</p>
</li>
<li>
<p dir="auto">capital වල ASCII අගය පරාසය 65 හා 90 අතර වේ.</p>
</li>
<li>
<p dir="auto">ඔබට පෙනෙනවා ඇති සෑම simple අකුරකම ASCII අගය සෑම capital අකුරකම ASCII අගයට වඩා 32කින් වැඩි බව.</p>
</li>
<li>
<p dir="auto">අපි ඇතුලත් කරන වාක්‍යය අකුරු වලට කඩා එම අකුරු simple වල ASCII අගය පරාසය වන 97 හා 122 අතරදැයි බලා එය සත්‍ය නම් එම අගයයන් වලින් 32ක ගානේ අඩු කලොත් අපට අපේ අකුරු capital වලට හැරවීමට හැකි බව ඔබට තේරෙනවා ඇති.</p>
</li>
</ul>
<pre><code># include &lt;stdio.h&gt;
# include &lt;string.h&gt;

int main (void)
{
	char word[100];
	int i = 0;

	printf("Enter a string = ");
	scanf("%s", word);

	while(strlen(word) &gt;= i)
	{
		if(word[i] &gt;= 97 &amp;&amp; word[i] &lt;= 122) // අපි input කල වචනයේ අකුරින් අකුර simple letter එකක්දැයි පරීක්ෂා කර බැලීම. එනම් ASCII අගය පරාසය වන 97 හා 122 අතරදැයි පරීක්ෂා කිරීම
		{
			word[i] = word[i] - 32; // අගය පරාසය වන 97 හා 122 අතර අතරනම් එම අකුර capital බවට හැරවීමට 32ක් අඩු කිරීම. එවිට එම simple අකුරු capital අකුරු බවට හැරවේ.
		}
		i++;
	}

	printf("After converting it to uppercase = %s", word);
	
	return 0;
}
</code></pre>
<p dir="auto"><strong>Output -:</strong></p>
<pre><code>Enter a string = kalana
After converting it to uppercase = KALANA
</code></pre>
<ul>
<li><strong><code>if(word[i] &gt;= 97 &amp;&amp; word[i] &lt;= 122)</code> වෙනුවට <code>if(word[i] &gt;= 65 &amp;&amp; word[i] &lt;= 90)</code> යෙදීමෙන් capital letters හරවන්න පුලුවන් simple letters බවට</strong></li>
</ul>
<hr />
<p dir="auto">මන් ඔයාලට තව ප්‍රශ්නයක් දෙන්නම් උත්තරත් එක්ක. තනියම ට්‍රයි කරලා බලන්න උත්තර බලන් නැතුව.</p>
<p dir="auto"><strong>Question 3 -:</strong> A palindrome is a word, phrase, number or other sequence of characters which reads the same backward and forward. Write a C program that enter a word, store it in a array and determine whether it is palindrome or not.</p>
<pre><code>Example : CIVIC is a palindrome
          HOT is a not a palindrome
</code></pre>
<p dir="auto">palindrome කියන්නේ වචනයක් අනිත් පැත්ත හැරෙව්වත් තිබුණ විදිහටම තියෙන වචන <code>CIVIC</code> කියන එකේ අකුරු අනිත් පැත්ත හැරෙව්වත් ඒක ආයේ කියැවෙන්නෙත් <code>CIVIC</code> විදිහටමයි. ඒත් <code>HOT</code> කියන එක අනිත් පැත්ත හැරෙව්වොත් කියැවෙන්නේ <code>TOH</code> ලෙසයි. එමනිසා HOT කියන එක palindrome එකක් නොවේ.</p>
<p dir="auto"><strong>Answer -:</strong> <a href="https://drive.google.com/open?id=1_zT4tXtYW6jQL5PySmXImp3_7ngAYbxw" target="_blank" rel="noopener noreferrer nofollow ugc">https://drive.google.com/open?id=1_zT4tXtYW6jQL5PySmXImp3_7ngAYbxw</a></p>
<p dir="auto"><strong>Another Answer -:</strong> <a href="https://drive.google.com/open?id=1xhp3bUjwmH-jPQ0FQyAUOln8BJp9sFzI" target="_blank" rel="noopener noreferrer nofollow ugc">https://drive.google.com/open?id=1xhp3bUjwmH-jPQ0FQyAUOln8BJp9sFzI</a></p>
<hr />
<ul>
<li>C programm එකක් windows වල  run කරන විදිහ --&gt; <a href="https://bit.ly/2O6rLXR" target="_blank" rel="noopener noreferrer nofollow ugc">https://bit.ly/2O6rLXR</a></li>
</ul>
<p dir="auto">ඔබට අවශ්‍යනම් ඔබේ බ්‍රව්සර් එක හරහා online C programms run කරන්න පුලුවන්. එහෙම කරන්න පුලුවන් ලින්ක්ස් මන් පහතින් දාන්නම්</p>
<ul>
<li><a href="https://www.onlinegdb.com/online_c_compiler" target="_blank" rel="noopener noreferrer nofollow ugc">https://www.onlinegdb.com/online_c_compiler</a></li>
<li><a href="https://www.tutorialspoint.com/compile_c_online.php" target="_blank" rel="noopener noreferrer nofollow ugc">https://www.tutorialspoint.com/compile_c_online.php</a></li>
<li><a href="https://repl.it/languages/c" target="_blank" rel="noopener noreferrer nofollow ugc">https://repl.it/languages/c</a></li>
</ul>
<p dir="auto">සරලව මුල ඉදන්  C programming ඉගෙන ගන්න පුලුවන් හොදම site කිහිපයක් මන් දාන්නම්</p>
<ul>
<li><a href="https://www.geeksforgeeks.org/c-programming-language/" target="_blank" rel="noopener noreferrer nofollow ugc">https://www.geeksforgeeks.org/c-programming-language/</a></li>
<li><a href="https://www.tutorialspoint.com/cprogramming/index.htm" target="_blank" rel="noopener noreferrer nofollow ugc">https://www.tutorialspoint.com/cprogramming/index.htm</a></li>
<li><a href="https://beginnersbook.com/2014/01/c-tutorial-for-beginners-with-examples/" target="_blank" rel="noopener noreferrer nofollow ugc">https://beginnersbook.com/2014/01/c-tutorial-for-beginners-with-examples/</a></li>
</ul>
<p dir="auto"><strong>web url කෙටි කරන්න lankadevelopers ලා හදපු එයාලගෙම සයිට් එකක් තියෙනවා. -&gt;</strong> <a href="https://link.lankadevelopers.com/" target="_blank" rel="noopener noreferrer nofollow ugc">https://link.lankadevelopers.com/</a></p>
<p dir="auto"><strong>මගේ කලින් ලිපි</strong></p>
<ul>
<li>C Programming මුල සිට ඉගෙනගනිමු(part 1 - Introduction) -: <a href="https://link.lankadevelopers.com/4WpH" target="_blank" rel="noopener noreferrer nofollow ugc">https://link.lankadevelopers.com/4WpH</a></li>
<li>C Programming මුල සිට ඉගෙනගනිමු (part 2 - Variables) -: <a href="https://link.lankadevelopers.com/mXio" target="_blank" rel="noopener noreferrer nofollow ugc">https://link.lankadevelopers.com/mXio</a></li>
<li>C Programming මුල සිට ඉගෙනගනිමු (part 3 - Operators) -: <a href="https://link.lankadevelopers.com/SHNt" target="_blank" rel="noopener noreferrer nofollow ugc">https://link.lankadevelopers.com/SHNt</a></li>
<li>C Programming මුල සිට ඉගෙනගනිමු (part 4 - Input &amp; Output functions) -: <a href="https://link.lankadevelopers.com/2MNku" target="_blank" rel="noopener noreferrer nofollow ugc">https://link.lankadevelopers.com/2MNku</a></li>
<li>C Programming මුල සිට ඉගෙනගනිමු (part 5 - create simple applications) -: <a href="https://link.lankadevelopers.com/KUF6" target="_blank" rel="noopener noreferrer nofollow ugc">https://link.lankadevelopers.com/KUF6</a></li>
<li>C Programming මුල සිට ඉගෙනගනිමු (part 6 - Decision making(if-else statement - part 1)) -: <a href="https://link.lankadevelopers.com/8Xe71" target="_blank" rel="noopener noreferrer nofollow ugc">https://link.lankadevelopers.com/8Xe71</a></li>
<li>C Programming මුල සිට ඉගෙනගනිමු (part 7 - Format Specifiers in C) -: <a href="https://link.lankadevelopers.com/761PT" target="_blank" rel="noopener noreferrer nofollow ugc">https://link.lankadevelopers.com/761PT</a></li>
<li>C Programming මුල සිට ඉගෙනගනිමු (part 8 - Switch Statement) -: <a href="https://link.lankadevelopers.com/7jncK" target="_blank" rel="noopener noreferrer nofollow ugc">https://link.lankadevelopers.com/7jncK</a></li>
<li>C Programming මුල සිට ඉගෙනගනිමු (part 9 - While loop) -: <a href="https://link.lankadevelopers.com/4TBV5" target="_blank" rel="noopener noreferrer nofollow ugc">https://link.lankadevelopers.com/4TBV5</a></li>
<li>C Programming මුල සිට ඉගෙනගනිමු (part 10 - do-while loop) -: <a href="https://link.lankadevelopers.com/4WcNd" target="_blank" rel="noopener noreferrer nofollow ugc">https://link.lankadevelopers.com/4WcNd</a></li>
<li>C Programming මුල සිට ඉගෙනගනිමු (part 11 - for loop) -: <a href="https://link.lankadevelopers.com/8utoa" target="_blank" rel="noopener noreferrer nofollow ugc">https://link.lankadevelopers.com/8utoa</a></li>
<li>C Programming මුල සිට ඉගෙනගනිමු (part 12 - arrays) -: <a href="https://link.lankadevelopers.com/46cyf" target="_blank" rel="noopener noreferrer nofollow ugc">https://link.lankadevelopers.com/46cyf</a></li>
<li>C Programming මුල සිට ඉගෙනගනිමු (part 13 - 2D-arrays) -: <a href="https://link.lankadevelopers.com/4Q9Gt" target="_blank" rel="noopener noreferrer nofollow ugc">https://link.lankadevelopers.com/4Q9Gt</a></li>
<li>C Programming මුල සිට ඉගෙනගනිමු (part 14 - Strings) -: <a href="https://link.lankadevelopers.com/58zWd" target="_blank" rel="noopener noreferrer nofollow ugc">https://link.lankadevelopers.com/58zWd</a></li>
</ul>
<p dir="auto">මේ ලිපියෙන් Strings වල එන මූලික කරුණු සියල්ලක්ම පාහේ අපි සාකච්ජා කලා. මන් ඊලග ලිපියෙන් C functions ගැන හා ඒවා භාවිතා කරන විදිහ ඔයාලට කියලා දෙන්නම්. මගේ ලිපි වල අඩුපාඩු තියෙනවනම් දන්නේ නැති දේවල් තියෙනවනම් පහලින් කමෙන්ට් එකක් දාන්න.</p>
<p dir="auto">තව ලිපියකින් හම්බෙමු ජය වේවා.</p>
]]></description><link>https://lankadevelopers.lk/topic/491/c-programming-ම-ල-ස-ට-ඉග-නගන-ම-part-15-strings-q-a</link><guid isPermaLink="true">https://lankadevelopers.lk/topic/491/c-programming-ම-ල-ස-ට-ඉග-නගන-ම-part-15-strings-q-a</guid><dc:creator><![CDATA[Kalana]]></dc:creator><pubDate>Invalid Date</pubDate></item><item><title><![CDATA[C Programming මුල සිට ඉගෙනගනිමු (part 14 - Strings)]]></title><description><![CDATA[<p dir="auto">digatama karanna, all da best,</p>
]]></description><link>https://lankadevelopers.lk/topic/489/c-programming-ම-ල-ස-ට-ඉග-නගන-ම-part-14-strings</link><guid isPermaLink="true">https://lankadevelopers.lk/topic/489/c-programming-ම-ල-ස-ට-ඉග-නගන-ම-part-14-strings</guid><dc:creator><![CDATA[40D3R]]></dc:creator><pubDate>Invalid Date</pubDate></item><item><title><![CDATA[C Programming මුල සිට ඉගෙනගනිමු (part 13 - 2D-arrays)]]></title><description><![CDATA[<p dir="auto">Fatta bro. Thanks</p>
]]></description><link>https://lankadevelopers.lk/topic/488/c-programming-ම-ල-ස-ට-ඉග-නගන-ම-part-13-2d-arrays</link><guid isPermaLink="true">https://lankadevelopers.lk/topic/488/c-programming-ම-ල-ස-ට-ඉග-නගන-ම-part-13-2d-arrays</guid><dc:creator><![CDATA[root]]></dc:creator><pubDate>Invalid Date</pubDate></item><item><title><![CDATA[C Programming මුල සිට ඉගෙනගනිමු (part 12 - arrays)]]></title><description><![CDATA[<p dir="auto">Thanks.Keep it up &lt;3</p>
]]></description><link>https://lankadevelopers.lk/topic/480/c-programming-ම-ල-ස-ට-ඉග-නගන-ම-part-12-arrays</link><guid isPermaLink="true">https://lankadevelopers.lk/topic/480/c-programming-ම-ල-ස-ට-ඉග-නගන-ම-part-12-arrays</guid><dc:creator><![CDATA[MrCentimetre]]></dc:creator><pubDate>Invalid Date</pubDate></item><item><title><![CDATA[C Programming මුල සිට ඉගෙනගනිමු (part 11 - for loop)]]></title><description><![CDATA[<p dir="auto">Thank you so much. Great post! Here are some new pattern programs in C<br />
<a href="https://techstudy.org/cLanguage/starPattern" target="_blank" rel="noopener noreferrer nofollow ugc">https://techstudy.org/cLanguage/starPattern</a></p>
]]></description><link>https://lankadevelopers.lk/topic/479/c-programming-ම-ල-ස-ට-ඉග-නගන-ම-part-11-for-loop</link><guid isPermaLink="true">https://lankadevelopers.lk/topic/479/c-programming-ම-ල-ස-ට-ඉග-නගන-ම-part-11-for-loop</guid><dc:creator><![CDATA[codedebugger]]></dc:creator><pubDate>Invalid Date</pubDate></item><item><title><![CDATA[C Programming මුල සිට ඉගෙනගනිමු (part 10 - do-while loop)]]></title><description><![CDATA[<p dir="auto">superb bro</p>
]]></description><link>https://lankadevelopers.lk/topic/478/c-programming-ම-ල-ස-ට-ඉග-නගන-ම-part-10-do-while-loop</link><guid isPermaLink="true">https://lankadevelopers.lk/topic/478/c-programming-ම-ල-ස-ට-ඉග-නගන-ම-part-10-do-while-loop</guid><dc:creator><![CDATA[root]]></dc:creator><pubDate>Invalid Date</pubDate></item><item><title><![CDATA[C Programming මුල සිට ඉගෙනගනිමු (part 9 - While loop)]]></title><description><![CDATA[<p dir="auto">thanks bro superb</p>
]]></description><link>https://lankadevelopers.lk/topic/473/c-programming-ම-ල-ස-ට-ඉග-නගන-ම-part-9-while-loop</link><guid isPermaLink="true">https://lankadevelopers.lk/topic/473/c-programming-ම-ල-ස-ට-ඉග-නගන-ම-part-9-while-loop</guid><dc:creator><![CDATA[dev_lak]]></dc:creator><pubDate>Invalid Date</pubDate></item><item><title><![CDATA[C Programming මුල සිට ඉගෙනගනිමු (part 8 - Switch Statement)]]></title><description><![CDATA[<p dir="auto">superb bro, thank you.</p>
]]></description><link>https://lankadevelopers.lk/topic/469/c-programming-ම-ල-ස-ට-ඉග-නගන-ම-part-8-switch-statement</link><guid isPermaLink="true">https://lankadevelopers.lk/topic/469/c-programming-ම-ල-ස-ට-ඉග-නගන-ම-part-8-switch-statement</guid><dc:creator><![CDATA[root]]></dc:creator><pubDate>Invalid Date</pubDate></item><item><title><![CDATA[C Programming මුල සිට ඉගෙනගනිමු (part 7 - Format Specifiers in C)]]></title><description><![CDATA[<p dir="auto">Happy new year bro , thanks</p>
]]></description><link>https://lankadevelopers.lk/topic/466/c-programming-ම-ල-ස-ට-ඉග-නගන-ම-part-7-format-specifiers-in-c</link><guid isPermaLink="true">https://lankadevelopers.lk/topic/466/c-programming-ම-ල-ස-ට-ඉග-නගන-ම-part-7-format-specifiers-in-c</guid><dc:creator><![CDATA[Nubelle]]></dc:creator><pubDate>Invalid Date</pubDate></item><item><title><![CDATA[C Programming මුල සිට ඉගෙනගනිමු (part 6 - Decision making(if-else statement - part 2))]]></title><description><![CDATA[<p dir="auto">patta bro</p>
]]></description><link>https://lankadevelopers.lk/topic/446/c-programming-ම-ල-ස-ට-ඉග-නගන-ම-part-6-decision-making-if-else-statement-part-2</link><guid isPermaLink="true">https://lankadevelopers.lk/topic/446/c-programming-ම-ල-ස-ට-ඉග-නගන-ම-part-6-decision-making-if-else-statement-part-2</guid><dc:creator><![CDATA[Nubelle]]></dc:creator><pubDate>Invalid Date</pubDate></item><item><title><![CDATA[C Programming මුල සිට ඉගෙනගනිමු (part 6 - Decision making(if-else statement - part 1))]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://lankadevelopers.lk/uid/27">@root</a> ow okkoma page eken publish karannam</p>
]]></description><link>https://lankadevelopers.lk/topic/445/c-programming-ම-ල-ස-ට-ඉග-නගන-ම-part-6-decision-making-if-else-statement-part-1</link><guid isPermaLink="true">https://lankadevelopers.lk/topic/445/c-programming-ම-ල-ස-ට-ඉග-නගන-ම-part-6-decision-making-if-else-statement-part-1</guid><dc:creator><![CDATA[dev_lak]]></dc:creator><pubDate>Invalid Date</pubDate></item><item><title><![CDATA[C Programming මුල සිට ඉගෙනගනිමු (part 5 - create simple applications)]]></title><description><![CDATA[<p dir="auto">niyamai bro...</p>
]]></description><link>https://lankadevelopers.lk/topic/444/c-programming-ම-ල-ස-ට-ඉග-නගන-ම-part-5-create-simple-applications</link><guid isPermaLink="true">https://lankadevelopers.lk/topic/444/c-programming-ම-ල-ස-ට-ඉග-නගන-ම-part-5-create-simple-applications</guid><dc:creator><![CDATA[dev_lak]]></dc:creator><pubDate>Invalid Date</pubDate></item><item><title><![CDATA[C Programming මුල සිට ඉගෙනගනිමු (part 4 - Input &amp; Output functions)]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://lankadevelopers.lk/uid/1">@ciaompe</a>  එල මන් කිහිපයක්ම දාන්නම්.තෑන්ක් යූ</p>
]]></description><link>https://lankadevelopers.lk/topic/442/c-programming-ම-ල-ස-ට-ඉග-නගන-ම-part-4-input-output-functions</link><guid isPermaLink="true">https://lankadevelopers.lk/topic/442/c-programming-ම-ල-ස-ට-ඉග-නගන-ම-part-4-input-output-functions</guid><dc:creator><![CDATA[Kalana]]></dc:creator><pubDate>Invalid Date</pubDate></item><item><title><![CDATA[C Programming මුල සිට ඉගෙනගනිමු (part 3 - Operators)]]></title><description><![CDATA[<p dir="auto">Keep it up bro</p>
]]></description><link>https://lankadevelopers.lk/topic/439/c-programming-ම-ල-ස-ට-ඉග-නගන-ම-part-3-operators</link><guid isPermaLink="true">https://lankadevelopers.lk/topic/439/c-programming-ම-ල-ස-ට-ඉග-නගන-ම-part-3-operators</guid><dc:creator><![CDATA[imadusanka]]></dc:creator><pubDate>Invalid Date</pubDate></item><item><title><![CDATA[C Programming මුල සිට ඉගෙනගනිමු (part 2 - Variables)]]></title><description><![CDATA[<p dir="auto">නියමයි බ්‍රෝ</p>
]]></description><link>https://lankadevelopers.lk/topic/437/c-programming-ම-ල-ස-ට-ඉග-නගන-ම-part-2-variables</link><guid isPermaLink="true">https://lankadevelopers.lk/topic/437/c-programming-ම-ල-ස-ට-ඉග-නගන-ම-part-2-variables</guid><dc:creator><![CDATA[imadusanka]]></dc:creator><pubDate>Invalid Date</pubDate></item><item><title><![CDATA[C Programming මුල සිට ඉගෙනගනිමු(part 1 - Introduction)]]></title><description><![CDATA[<p dir="auto">niyamy brooo</p>
]]></description><link>https://lankadevelopers.lk/topic/435/c-programming-ම-ල-ස-ට-ඉග-නගන-ම-part-1-introduction</link><guid isPermaLink="true">https://lankadevelopers.lk/topic/435/c-programming-ම-ල-ස-ට-ඉග-නගන-ම-part-1-introduction</guid><dc:creator><![CDATA[Nubelle]]></dc:creator><pubDate>Invalid Date</pubDate></item><item><title><![CDATA[Compiling C programming]]></title><description><![CDATA[<p dir="auto">Niyama wadak</p>
]]></description><link>https://lankadevelopers.lk/topic/249/compiling-c-programming</link><guid isPermaLink="true">https://lankadevelopers.lk/topic/249/compiling-c-programming</guid><dc:creator><![CDATA[dev_lak]]></dc:creator><pubDate>Invalid Date</pubDate></item><item><title><![CDATA[Introduction to C language]]></title><description><![CDATA[<p dir="auto">C. Yes the classic C language is the mother language of many programing languages like C++/C# . Do you know that our lovely language , python interpreter is written in C .  In 1972 , C language was developed by “Dennis Ritchie” for UNIX. In early days C was used as the core language of UNIX operating system. Now many other operating systems use it as core language . Now C is one of the most widely used programming languages.<br />
<strong>Why I learn C?</strong></p>
<p dir="auto">1 ) Learn exploit development<br />
If you plan to learn exploit writing for windows or Linux , there are no excuses. You must learn C for understand those concepts. Also you need to learn how to compile C programs and how to debug them in a debugger.<br />
2 ) Learn reverse engineering or malware analysis.<br />
You need C for both of above sections because  C is  great for learn basics of computer architecture.<br />
3) Mange memory directly.<br />
C language allow you to work with memory unlike many other languages. You can use heap by using functions like malloc(). Also there are varies options like structs, pointers and arrays for access memory.</p>
<p dir="auto">There are bunch of reasons to learn C and I’m not going to write all of them hear.<br />
<strong>The concept of Functions</strong></p>
<p dir="auto">If I say C is built on a concept called a function,  I’m not wrong. Every little C program uses functions. It may be two three or more. But definitely there should be a one function. So first of all let’s understand what is a function. Think about this real life example. There is a group of human that trained to do a work. If we supply raw data, group will process those data and give us the result. We may supply different kind of data and the output will be different also, but the process is same.Only thing that group of humans do is launch a per-configured flaw on data. This situation is what happens inside a function.</p>
<p dir="auto">Now you have a clear idea about functions. Let’s see how a C program looks like.</p>
<pre><code>#include &lt;stdio.h&gt;
int main(){
  printf("welcome to hacksland\n");
  return 0;
}
</code></pre>
<p dir="auto">Oh too many lines of code. 😮 . In our python printing tutorial it took only one line to do the same as above.</p>
<pre><code>print("welcome to hacksland")
</code></pre>
<p dir="auto">You may think , why this much of code lines are required to a simple hello world program?. Well , You will realize this at end of the tutorial.<br />
Anyway we are going to analyze above C code and see what it actually does.</p>
<p dir="auto">First , focus only on 3rd line of code. You can see a format like this.</p>
<pre><code>printf("welcome to hacksland\n");
</code></pre>
<p dir="auto">What does it mean? It is a function. Yeah if we give a string to this function, it will print that to the screen. In above example we gave welcome to hacksland. So it will print that data . What about /n . That’s called a string terminator and we’ll talk more about that later.</p>
<p dir="auto">There is another thing to notice. Did you see a semicolon after the printf statement?. That’s how we indicate the end of a line in C language.</p>
<p dir="auto">Now it’s time to look at other parts of our code. In first line we can see a <em>#include &lt;studio.h&gt;</em> statement. What it does?. We used a function called printf in our code. But how computer know what to do when we give a string to the function. We give a set of instructions to do when function is called. So computer process those instructions and give the result. In above example stdio.h file is holding those instructions for printf function. That’s why we included it before use <a href="http://printf.In" target="_blank" rel="noopener noreferrer nofollow ugc">printf.In</a> Linux these Header files are located in  “/usr/include” . If we look inside a header file we can see printf function looks like following.</p>
<pre><code>int printf(){
  /*
  hear is the code for print the string that supplied to function.
  */
  return 0;
}
</code></pre>
<p dir="auto">There are couple of things to see.<br />
At the beginning of function you can see a keyword as int . Also there is a return 0 at end. First we say computer that after completing the function it will give an integer. Next using return 0 we give that value. ( Hear it is 0 ) . Actually value zero means function was completed successfully.</p>
<p dir="auto">In our example there was something as int main(). Do you believe if I say that’s also a function. ? 🙂<br />
Yes buddy. In this tutorial I said that there is even one function in every C program. That’s main function. Now you can understand why there is a int main() and return 0. Yes you guessed it. main function also return value zero after completing it.</p>
<p dir="auto">Ok guys. We got a clear idea on what is C and for what we can use it also we could understand basics of C <a href="http://language.In" target="_blank" rel="noopener noreferrer nofollow ugc">language.In</a> next tutorials we are going to go deep concepts of this awesome language. If you have any problems leave a comment. Thank you for reading.</p>
<p dir="auto">C you again.  🙂</p>
]]></description><link>https://lankadevelopers.lk/topic/248/introduction-to-c-language</link><guid isPermaLink="true">https://lankadevelopers.lk/topic/248/introduction-to-c-language</guid><dc:creator><![CDATA[Thilan Danushka]]></dc:creator><pubDate>Invalid Date</pubDate></item></channel></rss>