<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>EmbLogic &#187; Harminder Singh</title>
	<atom:link href="https://www.emblogic.com/blog/author/harminder-oassan/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.emblogic.com/blog</link>
	<description>Embedded System and ARM Training</description>
	<lastBuildDate>Tue, 03 Mar 2020 13:00:06 +0000</lastBuildDate>
	<language>en-US</language>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.9.1</generator>
	<item>
		<title>CHARACTER DRIVER INITIALIZATION,  OPENING , WRITING ,CLOSING, and CLEANUP.</title>
		<link>https://www.emblogic.com/blog/10/character-driver-initialization-opening-writing-closing-and-cleanup/</link>
		<comments>https://www.emblogic.com/blog/10/character-driver-initialization-opening-writing-closing-and-cleanup/#comments</comments>
		<pubDate>Thu, 09 Oct 2014 06:48:02 +0000</pubDate>
		<dc:creator><![CDATA[Harminder Singh]]></dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.emblogic.com/blog/?p=11555</guid>
		<description><![CDATA[RCS FILE OF THE HEADER.H OF THE CHARACTER DRIVER RCS file: header.h,v Working file: header.h head: 1.10 branch: locks: strict root: 1.10 access list: symbolic names: keyword substitution: kv total revisions: 10;    selected revisions: 10 description: This is the header &#8230; <a href="https://www.emblogic.com/blog/10/character-driver-initialization-opening-writing-closing-and-cleanup/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>RCS FILE OF THE HEADER.H OF THE CHARACTER DRIVER</p>
<p>RCS file: header.h,v<br />
Working file: header.h<br />
head: 1.10<br />
branch:<br />
locks: strict<br />
root: 1.10<br />
access list:<br />
symbolic names:<br />
keyword substitution: kv<br />
total revisions: 10;    selected revisions: 10<br />
description:<br />
This is the header file.<br />
Included init.h.<br />
Included module.h.<br />
using macro MODULE_LISCENCE.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.10    locked by: root;<br />
date: 2014/10/08 18:25:34;  author: root;  state: Exp;  lines: +1 -0<br />
included asm/uaccess.h.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.9<br />
date: 2014/10/08 07:04:32;  author: root;  state: Exp;  lines: +1 -1<br />
included kernel.h.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.8<br />
date: 2014/10/08 05:30:18;  author: root;  state: Exp;  lines: +4 -0<br />
declared macros QSETSIZE and QUANTSIZE.<br />
declared members qset_size and quant_size in the structure ScullDev.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.7<br />
date: 2014/09/26 08:45:24;  author: root;  state: Exp;  lines: +1 -1<br />
included kernel.h.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.6<br />
date: 2014/09/26 08:15:43;  author: root;  state: Exp;  lines: +1 -0<br />
Included kernel.h.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.5<br />
date: 2014/09/26 07:36:49;  author: root;  state: Exp;  lines: +11 -0<br />
Included slab.h.<br />
Defined struct ScullQset.<br />
Defined struct ScullQset.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.4<br />
date: 2014/09/26 07:15:22;  author: root;  state: Exp;  lines: +1 -0<br />
Included moduleparam.h.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.3<br />
date: 2014/09/26 07:01:34;  author: root;  state: Exp;  lines: +3 -0<br />
declared macro MAJORNO, MINORNO, NOD.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.2<br />
date: 2014/09/26 06:29:23;  author: root;  state: Exp;  lines: +3 -0<br />
Included fs.h.<br />
Included cdev.h.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.1<br />
date: 2014/09/26 06:06:05;  author: root;  state: Exp;<br />
Initial revision<br />
=============================================================================</p>
<p>RCS FILE OF THE DECLERATIONS.H OF THE CHARACTER DRIVER</p>
<p>RCS file: declare.h,v<br />
Working file: declare.h<br />
head: 1.8<br />
branch:<br />
locks: strict<br />
root: 1.8<br />
access list:<br />
symbolic names:<br />
keyword substitution: kv<br />
total revisions: 8;    selected revisions: 8<br />
description:<br />
This is the declerations file.<br />
Declared extern int dev_t dev.<br />
declared extern int nod.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.8    locked by: root;<br />
date: 2014/10/08 17:35:06;  author: root;  state: Exp;  lines: +1 -1<br />
minor bug.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.7<br />
date: 2014/10/08 05:31:28;  author: root;  state: Exp;  lines: +2 -0<br />
declared extern int qset_size and extern int quant_size.<br />
given prototype of dev_release().<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.6<br />
date: 2014/10/08 05:10:19;  author: root;  state: Exp;  lines: +1 -0<br />
minor bug.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.5<br />
date: 2014/10/08 04:59:11;  author: root;  state: Exp;  lines: +1 -0<br />
given prototype of dev_write() routine.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.4<br />
date: 2014/09/26 08:16:27;  author: root;  state: Exp;  lines: +1 -0<br />
given the prototype of the function dev_open().<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.3<br />
date: 2014/09/26 07:37:37;  author: root;  state: Exp;  lines: +1 -1<br />
Declared Struct SCullDev *sculldev.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.2<br />
date: 2014/09/26 07:02:49;  author: root;  state: Exp;  lines: +4 -0<br />
declared extern int majorno, extern int minorno.<br />
declared extern struct file_operations fops.<br />
declared extern struct cdev mycdev.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.1<br />
date: 2014/09/26 06:46:55;  author: root;  state: Exp;<br />
Initial revision<br />
=============================================================================</p>
<p>RCS FILE OF INIT.H OF THE CHARACTER DRIVER</p>
<p>RCS file: init.c,v<br />
Working file: init.c<br />
head: 1.10<br />
branch:<br />
locks: strict<br />
root: 1.10<br />
access list:<br />
symbolic names:<br />
keyword substitution: kv<br />
total revisions: 10;    selected revisions: 10<br />
description:<br />
This is the initialization routine.<br />
using macro module_init.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.10    locked by: root;<br />
date: 2014/10/08 05:32:09;  author: root;  state: Exp;  lines: +4 -0<br />
assigned value to qset_size and quant_size.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.9<br />
date: 2014/09/26 08:46:00;  author: root;  state: Exp;  lines: +1 -0<br />
Setting the initial value of scullqset member of sculldev to null.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.8<br />
date: 2014/09/26 08:16:46;  author: root;  state: Exp;  lines: +1 -1<br />
Included user defined header file file_init.h.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.7<br />
date: 2014/09/26 07:41:53;  author: root;  state: Exp;  lines: +15 -0<br />
debugging messages added.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.6<br />
date: 2014/09/26 07:38:01;  author: root;  state: Exp;  lines: +7 -6<br />
allocated memory to the sculldev using kmallo<br />
kmalloc*<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.5<br />
date: 2014/09/26 07:15:37;  author: root;  state: Exp;  lines: +15 -8<br />
adding multiple devices.<br />
accepting number of devises from module parameters.<br />
printing all major and minor numbers.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.4<br />
date: 2014/09/26 07:02:01;  author: root;  state: Exp;  lines: +16 -2<br />
initialising a device using cdev_init().<br />
Adding the device using cdev_add().<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.3<br />
date: 2014/09/26 06:33:02;  author: root;  state: Exp;  lines: +1 -1<br />
checking the return value of alloc_chrdev_region.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.2<br />
date: 2014/09/26 06:29:40;  author: root;  state: Exp;  lines: +19 -0<br />
Registering the driver using alloc_chrdev_region().<br />
printing the major number allocated.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.1<br />
date: 2014/09/26 06:06:05;  author: root;  state: Exp;<br />
Initial revision<br />
=============================================================================</p>
<p>RCS FILE OF OPEN ROUTICE OF CHAR DRIVER</p>
<p>RCS file: dev_open.c,v<br />
Working file: dev_open.c<br />
head: 1.5<br />
branch:<br />
locks: strict<br />
root: 1.5<br />
access list:<br />
symbolic names:<br />
keyword substitution: kv<br />
total revisions: 5;    selected revisions: 5<br />
description:<br />
This is the open routine of our device.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.5    locked by: root;<br />
date: 2014/09/26 08:50:16;  author: root;  state: Exp;  lines: +7 -2<br />
debugging.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.4<br />
date: 2014/09/26 08:49:01;  author: root;  state: Exp;  lines: +6 -0<br />
debugging messages.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.3<br />
date: 2014/09/26 08:46:31;  author: root;  state: Exp;  lines: +23 -1<br />
Implementing dev_trim().<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.2<br />
date: 2014/09/26 08:29:40;  author: root;  state: Exp;  lines: +18 -0<br />
using container_of function to put data into struct inode.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.1<br />
date: 2014/09/26 08:17:25;  author: root;  state: Exp;<br />
Initial revision<br />
=============================================================================</p>
<p>RCS IFLE OF WRITE ROUTINE OF CHAR DRIVER</p>
<p>RCS file: dev_write.c,v<br />
Working file: dev_write.c<br />
head: 1.11<br />
branch:<br />
locks: strict<br />
root: 1.11<br />
access list:<br />
symbolic names:<br />
keyword substitution: kv<br />
total revisions: 11;    selected revisions: 11<br />
description:<br />
this is write routine of this driver.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.11    locked by: root;<br />
date: 2014/10/08 18:26:11;  author: root;  state: Exp;  lines: +31 -7<br />
writing into sculldev from user buffer using macro copy_from_user.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.10<br />
date: 2014/10/08 17:54:16;  author: root;  state: Exp;  lines: +30 -3<br />
implemented create_quant.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.9<br />
date: 2014/10/08 17:35:16;  author: root;  state: Exp;  lines: +2 -1<br />
implementing create_qset.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.8<br />
date: 2014/10/08 17:28:39;  author: root;  state: Exp;  lines: +20 -0<br />
implementing create_qset.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.7<br />
date: 2014/10/08 07:05:57;  author: root;  state: Exp;  lines: +68 -17<br />
allocated scullqsets successfully.<br />
given prototype of create_qset.<br />
implementing create_qset.<br />
qsets allocated successfully.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.6<br />
date: 2014/10/08 05:40:37;  author: root;  state: Exp;  lines: +1 -1<br />
*** empty log message ***<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.5<br />
date: 2014/10/08 05:39:24;  author: root;  state: Exp;  lines: +1 -1<br />
debugging messages.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.4<br />
date: 2014/10/08 05:37:26;  author: root;  state: Exp;  lines: +3 -3<br />
minor error (% instead of /).<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.3<br />
date: 2014/10/08 05:33:06;  author: root;  state: Exp;  lines: +22 -1<br />
given prototype of create_scullqset().<br />
implementing create_scullqset(().<br />
calculating number of scullqset in function create_scullqset().<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.2<br />
date: 2014/10/08 05:16:39;  author: root;  state: Exp;  lines: +10 -1<br />
fetching data fropn file-&gt;private data into a local ScullDev variable.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.1<br />
date: 2014/10/08 05:04:21;  author: root;  state: Exp;<br />
Initial revision<br />
=============================================================================</p>
]]></content:encoded>
			<wfw:commentRss>https://www.emblogic.com/blog/10/character-driver-initialization-opening-writing-closing-and-cleanup/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>IPC using sockets AF_INET/ tcp</title>
		<link>https://www.emblogic.com/blog/08/ipc-using-sockets-af_inet-tcp/</link>
		<comments>https://www.emblogic.com/blog/08/ipc-using-sockets-af_inet-tcp/#comments</comments>
		<pubDate>Thu, 28 Aug 2014 05:36:16 +0000</pubDate>
		<dc:creator><![CDATA[Harminder Singh]]></dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.emblogic.com/blog/?p=11438</guid>
		<description><![CDATA[IPC Using SOCKETS AF_INET RCS file: server.c,v Working file: server.c head: 1.1 branch: locks: strict access list: symbolic names: keyword substitution: kv total revisions: 1;    selected revisions: 1 description: Server implementaton using TCP , AF_INET. &#62;&#62; Calls used : socket(), &#8230; <a href="https://www.emblogic.com/blog/08/ipc-using-sockets-af_inet-tcp/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>IPC Using SOCKETS AF_INET</p>
<p>RCS file: server.c,v<br />
Working file: server.c<br />
head: 1.1<br />
branch:<br />
locks: strict<br />
access list:<br />
symbolic names:<br />
keyword substitution: kv<br />
total revisions: 1;    selected revisions: 1<br />
description:<br />
Server implementaton using TCP , AF_INET.<br />
&gt;&gt; Calls used : socket(), bind(), listen(), accept().<br />
&gt;&gt; sockaddr_in<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.1<br />
date: 2014/08/28 05:26:46;  author: root;  state: Exp;<br />
Initial revision<br />
=============================================================================</p>
<p>RCS file: client.c,v<br />
Working file: client.c<br />
head: 1.1<br />
branch:<br />
locks: strict<br />
access list:<br />
symbolic names:<br />
keyword substitution: kv<br />
total revisions: 1;    selected revisions: 1<br />
description:<br />
AF_INET client program.<br />
calls used: bind(), connect.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.1<br />
date: 2014/08/28 05:31:42;  author: root;  state: Exp;<br />
Initial revision<br />
=============================================================================</p>
]]></content:encoded>
			<wfw:commentRss>https://www.emblogic.com/blog/08/ipc-using-sockets-af_inet-tcp/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>IPC using sockets AF_UNIX / TCP</title>
		<link>https://www.emblogic.com/blog/08/ipc-using-sockets-af_unix-tcp/</link>
		<comments>https://www.emblogic.com/blog/08/ipc-using-sockets-af_unix-tcp/#comments</comments>
		<pubDate>Thu, 28 Aug 2014 05:33:34 +0000</pubDate>
		<dc:creator><![CDATA[Harminder Singh]]></dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.emblogic.com/blog/?p=11436</guid>
		<description><![CDATA[IPC Using SOCKETS AF_UNIX RCS file: server.c,v Working file: server.c head: 1.1 branch: locks: strict access list: symbolic names: keyword substitution: kv total revisions: 1;    selected revisions: 1 description: Server implementaton using TCP , AF_UNIX. &#62;&#62; Calls used : socket(), &#8230; <a href="https://www.emblogic.com/blog/08/ipc-using-sockets-af_unix-tcp/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>IPC Using SOCKETS AF_UNIX</p>
<p>RCS file: server.c,v<br />
Working file: server.c<br />
head: 1.1<br />
branch:<br />
locks: strict<br />
access list:<br />
symbolic names:<br />
keyword substitution: kv<br />
total revisions: 1;    selected revisions: 1<br />
description:<br />
Server implementaton using TCP , AF_UNIX.<br />
&gt;&gt; Calls used : socket(), bind(), listen(), accept().<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.1<br />
date: 2014/08/28 05:26:46;  author: root;  state: Exp;<br />
Initial revision<br />
=============================================================================</p>
<p>RCS file: client.c,v<br />
Working file: client.c<br />
head: 1.1<br />
branch:<br />
locks: strict<br />
access list:<br />
symbolic names:<br />
keyword substitution: kv<br />
total revisions: 1;    selected revisions: 1<br />
description:<br />
AF_UXIX client program.<br />
calls used: bind(), connect.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.1<br />
date: 2014/08/28 05:31:42;  author: root;  state: Exp;<br />
Initial revision<br />
=============================================================================</p>
]]></content:encoded>
			<wfw:commentRss>https://www.emblogic.com/blog/08/ipc-using-sockets-af_unix-tcp/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Inter Process Communication using MESSAGE QUEUES.</title>
		<link>https://www.emblogic.com/blog/08/inter-process-communication-using-message-queues/</link>
		<comments>https://www.emblogic.com/blog/08/inter-process-communication-using-message-queues/#comments</comments>
		<pubDate>Thu, 28 Aug 2014 05:10:03 +0000</pubDate>
		<dc:creator><![CDATA[Harminder Singh]]></dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.emblogic.com/blog/?p=11434</guid>
		<description><![CDATA[IPC USING MESSAGE QUEUES RCS file: header.h,v Working file: header.h head: 1.1 branch: locks: strict access list: symbolic names: keyword substitution: kv total revisions: 1;    selected revisions: 1 description: included stdio.h, sys/msg.h, stdlib.h, sys/types.h, unistd.h, sys/ipc.h. &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;- revision 1.1 date: &#8230; <a href="https://www.emblogic.com/blog/08/inter-process-communication-using-message-queues/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>IPC USING MESSAGE QUEUES</p>
<p>RCS file: header.h,v<br />
Working file: header.h<br />
head: 1.1<br />
branch:<br />
locks: strict<br />
access list:<br />
symbolic names:<br />
keyword substitution: kv<br />
total revisions: 1;    selected revisions: 1<br />
description:<br />
included stdio.h, sys/msg.h, stdlib.h, sys/types.h, unistd.h, sys/ipc.h.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.1<br />
date: 2014/08/28 04:44:56;  author: root;  state: Exp;<br />
Initial revision<br />
=============================================================================</p>
<p>RCS file: server.c,v<br />
Working file: server.c<br />
head: 1.1<br />
branch:<br />
locks: strict<br />
access list:<br />
symbolic names:<br />
keyword substitution: kv<br />
total revisions: 1;    selected revisions: 1<br />
description:<br />
this is the server program.<br />
it creates a message queue and waits to recieve data on it from a requesting client.<br />
multiple fork calls are made according to the number of requesting client<br />
each child of the server deals with respective client and sychronisation chived by the type field given in each message queue structure.<br />
then the server sends a processing requst to the processing client.<br />
once the processing client returns the result on a seperate message queue, the server puts the result back on the respective client message queue.<br />
each client then picks up the message according to the type specified, which in turn is their own pid(process id).<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.1<br />
date: 2014/08/28 04:54:05;  author: root;  state: Exp;<br />
Initial revision<br />
=============================================================================</p>
<p>RCS file: client.c,v<br />
Working file: client.c<br />
head: 1.1<br />
branch:<br />
locks: strict<br />
access list:<br />
symbolic names:<br />
keyword substitution: kv<br />
total revisions: 1;    selected revisions: 1<br />
description:<br />
This is the requesting client program.<br />
It sends a request on the message queue created by the server.<br />
and waits for the processed result.<br />
picks up the message of its own type only.<br />
here tpre is the pid of client.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.1<br />
date: 2014/08/28 05:05:52;  author: root;  state: Exp;<br />
Initial revision<br />
=============================================================================</p>
<p>RCS file: process.c,v<br />
Working file: process.c<br />
head: 1.1<br />
branch:<br />
locks: strict<br />
access list:<br />
symbolic names:<br />
keyword substitution: kv<br />
total revisions: 1;    selected revisions: 1<br />
description:<br />
This is the processing client.<br />
it performs the calculations on request from the server.<br />
and returns the answer in a message queue created by the server.<br />
with a particular type attached to the mesage.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.1<br />
date: 2014/08/28 05:08:33;  author: root;  state: Exp;<br />
Initial revision<br />
=============================================================================</p>
]]></content:encoded>
			<wfw:commentRss>https://www.emblogic.com/blog/08/inter-process-communication-using-message-queues/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>IPC USING FIFOS AND SEMAPHORES.</title>
		<link>https://www.emblogic.com/blog/08/ipc-using-fifos-and-semaphores/</link>
		<comments>https://www.emblogic.com/blog/08/ipc-using-fifos-and-semaphores/#comments</comments>
		<pubDate>Tue, 12 Aug 2014 11:41:24 +0000</pubDate>
		<dc:creator><![CDATA[Harminder Singh]]></dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.emblogic.com/blog/?p=11384</guid>
		<description><![CDATA[HEADER FILE *************************************************************** RCS file: ./header.h,v Working file: ./header.h head: 1.1 branch: locks: strict access list: symbolic names: keyword substitution: kv total revisions: 1;    selected revisions: 1 description: Included &#8220;stdio.h&#8221; , &#8220;stdlib.h&#8221;, &#8220;unistd.h&#8221;, &#8220;linux/sem.h&#8221;, &#8220;fcntl.h&#8221;, and &#8220;signal.h&#8221;. Declaration of the &#8230; <a href="https://www.emblogic.com/blog/08/ipc-using-fifos-and-semaphores/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>HEADER FILE ***************************************************************</p>
<p>RCS file: ./header.h,v<br />
Working file: ./header.h<br />
head: 1.1<br />
branch:<br />
locks: strict<br />
access list:<br />
symbolic names:<br />
keyword substitution: kv<br />
total revisions: 1;    selected revisions: 1<br />
description:<br />
Included &#8220;stdio.h&#8221; , &#8220;stdlib.h&#8221;, &#8220;unistd.h&#8221;, &#8220;linux/sem.h&#8221;, &#8220;fcntl.h&#8221;, and &#8220;signal.h&#8221;.<br />
Declaration of the structure &#8220;package&#8221;, with members &#8211; op1(int), op2(int), arth(char), pid(pid_t), result(int).<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.1<br />
date: 2014/08/12 10:59:58;  author: root;  state: Exp;<br />
Initial revision<br />
=============================================================================</p>
<p>SERVER PROGRAM **************************************************************</p>
<p>RCS file: ./server.c,v<br />
Working file: ./server.c<br />
head: 1.1<br />
branch:<br />
locks: strict<br />
access list:<br />
symbolic names:<br />
keyword substitution: kv<br />
total revisions: 1;    selected revisions: 1<br />
description:<br />
This is the server program .<br />
Declared 3 fifos , 1 for client routines and 2 for processing routines.<br />
fork children of the server. number of children is equal to number of clients.<br />
Each child links with respective clients and reads the data to be processed.<br />
then the forked child send the data to the processing client .<br />
gets the result back, and sends it to the client.<br />
semaphores are used wherever fifos are shared.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.1<br />
date: 2014/08/12 11:18:11;  author: root;  state: Exp;<br />
Initial revision<br />
=============================================================================</p>
<p>CLIENT PROGRAM **************************************************************</p>
<p>RCS file: ./client.c,v<br />
Working file: ./client.c<br />
head: 1.1<br />
branch:<br />
locks: strict<br />
access list:<br />
symbolic names:<br />
keyword substitution: kv<br />
total revisions: 1;    selected revisions: 1<br />
description:<br />
This is the client program.<br />
It writes the values to b written into the fifo for server to read it.<br />
this it pauses using pause() system call.<br />
when the server has the answer it prompts the client by sending it a signal using kill system call.<br />
the respective client whose pid is present in the kill() is resumed , reads the result and displays it.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.1<br />
date: 2014/08/12 11:21:10;  author: root;  state: Exp;<br />
Initial revision<br />
=============================================================================</p>
<p>ADD PROCESSING CLIENT *******************************************************</p>
<p>RCS file: ./add.c,v<br />
Working file: ./add.c<br />
head: 1.1<br />
branch:<br />
locks: strict<br />
access list:<br />
symbolic names:<br />
keyword substitution: kv<br />
total revisions: 1;    selected revisions: 1<br />
description:<br />
This is the addition processing client.<br />
it reads the values from server using one fifo.<br />
each processing client is using a common fifo to write back the result to server.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.1<br />
date: 2014/08/12 11:23:54;  author: root;  state: Exp;<br />
Initial revision<br />
=============================================================================</p>
<p>SUBTRACT PROCESSING CLIENT **************************************************</p>
<p>RCS file: ./subtract.c,v<br />
Working file: ./subtract.c<br />
head: 1.1<br />
branch:<br />
locks: strict<br />
access list:<br />
symbolic names:<br />
keyword substitution: kv<br />
total revisions: 1;    selected revisions: 1<br />
description:<br />
This is the subtracting client.<br />
it reads the values from server using one fifo.<br />
each processing client is using a common fifo to write back the result to server.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-</p>
]]></content:encoded>
			<wfw:commentRss>https://www.emblogic.com/blog/08/ipc-using-fifos-and-semaphores/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>INTER PROCESS COMMUNICATION USING PIPES.(client server based)</title>
		<link>https://www.emblogic.com/blog/08/inter-process-communication-using-pipes-client-server-based/</link>
		<comments>https://www.emblogic.com/blog/08/inter-process-communication-using-pipes-client-server-based/#comments</comments>
		<pubDate>Sat, 02 Aug 2014 07:42:02 +0000</pubDate>
		<dc:creator><![CDATA[Harminder Singh]]></dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.emblogic.com/blog/?p=11343</guid>
		<description><![CDATA[INTER PROCESS COMMUNICATION USING PIPES. RCS file: header.h,v Working file: header.h head: 1.1 branch: locks: strict access list: symbolic names: keyword substitution: kv total revisions: 1;    selected revisions: 1 description: Included stdio.h. and fcntl.h. ,sys/types.h, stdlib.h, unistd.h. &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;- revision 1.1 &#8230; <a href="https://www.emblogic.com/blog/08/inter-process-communication-using-pipes-client-server-based/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>INTER PROCESS COMMUNICATION USING PIPES.</p>
<p>RCS file: header.h,v<br />
Working file: header.h<br />
head: 1.1<br />
branch:<br />
locks: strict<br />
access list:<br />
symbolic names:<br />
keyword substitution: kv<br />
total revisions: 1;    selected revisions: 1<br />
description:<br />
Included stdio.h.<br />
and fcntl.h.<br />
,sys/types.h, stdlib.h, unistd.h.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.1<br />
date: 2014/08/02 03:44:56;  author: root;  state: Exp;<br />
Initial revision<br />
=============================================================================</p>
<p>RCS file: pipes.c,v<br />
Working file: pipes.c<br />
head: 1.2<br />
branch:<br />
locks: strict<br />
access list:<br />
symbolic names:<br />
keyword substitution: kv<br />
total revisions: 2;    selected revisions: 2<br />
description:<br />
Main function of the inter process communication program.<br />
calling the client function to generate clients.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.2<br />
date: 2014/08/02 04:57:36;  author: root;  state: Exp;  lines: +17 -1<br />
forking three independent clients.<br />
with different values.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.1<br />
date: 2014/08/02 03:44:56;  author: root;  state: Exp;<br />
Initial revision<br />
=============================================================================</p>
<p>RCS file: define.c,v<br />
Working file: define.c<br />
head: 1.4<br />
branch:<br />
locks: strict<br />
access list:<br />
symbolic names:<br />
keyword substitution: kv<br />
total revisions: 4;    selected revisions: 4<br />
description:<br />
definations of functions client(),<br />
operator_l()&#8211;services the client ,forks and execls appropriate service program.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.4<br />
date: 2014/08/02 05:14:43;  author: root;  state: Exp;  lines: +5 -3<br />
client was showing first operand as result.<br />
fixed it.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.3<br />
date: 2014/08/02 04:57:02;  author: root;  state: Exp;  lines: +9 -3<br />
added fcntl.h.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.2<br />
date: 2014/08/02 03:47:28;  author: root;  state: Exp;  lines: +0 -24<br />
*** empty log message ***<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.1<br />
date: 2014/08/02 03:44:56;  author: root;  state: Exp;<br />
Initial revision<br />
=============================================================================</p>
<p>RCS file: client.c,v<br />
Working file: client.c<br />
head: 1.3<br />
branch:<br />
locks: strict<br />
access list:<br />
symbolic names:<br />
keyword substitution: kv<br />
total revisions: 3;    selected revisions: 3<br />
description:<br />
This is the client program which requests the server to<br />
perform given operation on the two operands.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.3<br />
date: 2014/08/02 05:15:33;  author: root;  state: Exp;  lines: +2 -2<br />
now the client waits for the server to get results.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.2<br />
date: 2014/08/02 04:58:16;  author: root;  state: Exp;  lines: +6 -3<br />
now the client waits and reads the result from the server.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.1<br />
date: 2014/08/02 03:44:56;  author: root;  state: Exp;<br />
Initial revision<br />
=============================================================================</p>
<p>RCS file: add.c,v<br />
Working file: add.c<br />
head: 1.2<br />
branch:<br />
locks: strict<br />
access list:<br />
symbolic names:<br />
keyword substitution: kv<br />
total revisions: 2;    selected revisions: 2<br />
description:<br />
The program to add two numbers given by the client program.<br />
writes the result back to the server.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.2<br />
date: 2014/08/02 04:59:01;  author: root;  state: Exp;  lines: +1 -2<br />
*** empty log message ***<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.1<br />
date: 2014/08/02 03:44:56;  author: root;  state: Exp;<br />
Initial revision<br />
=============================================================================<br />
RCS file: subtract.c,v<br />
Working file: subtract.c<br />
head: 1.2<br />
branch:<br />
locks: strict<br />
access list:<br />
symbolic names:<br />
keyword substitution: kv<br />
total revisions: 2;    selected revisions: 2<br />
description:<br />
The program to subtract two numbers given by the client program.<br />
writes the result back to server.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.2<br />
date: 2014/08/02 04:59:05;  author: root;  state: Exp;  lines: +1 -2<br />
*** empty log message ***<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.1<br />
date: 2014/08/02 03:44:56;  author: root;  state: Exp;<br />
Initial revision<br />
=============================================================================</p>
<p>RCS file: multiply.c,v<br />
Working file: multiply.c<br />
head: 1.2<br />
branch:<br />
locks: strict<br />
access list:<br />
symbolic names:<br />
keyword substitution: kv<br />
total revisions: 2;    selected revisions: 2<br />
description:<br />
The program to multiply two numbers given by the client program.<br />
writes the result back to server.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.2<br />
date: 2014/08/02 04:59:06;  author: root;  state: Exp;  lines: +1 -2<br />
*** empty log message ***<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.1<br />
date: 2014/08/02 03:44:56;  author: root;  state: Exp;<br />
Initial revision<br />
=============================================================================</p>
]]></content:encoded>
			<wfw:commentRss>https://www.emblogic.com/blog/08/inter-process-communication-using-pipes-client-server-based/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Implementation of Circular Queue using linked list.</title>
		<link>https://www.emblogic.com/blog/07/implementation-of-circular-queue-using-linked-list/</link>
		<comments>https://www.emblogic.com/blog/07/implementation-of-circular-queue-using-linked-list/#comments</comments>
		<pubDate>Thu, 24 Jul 2014 05:16:56 +0000</pubDate>
		<dc:creator><![CDATA[Harminder Singh]]></dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.emblogic.com/blog/?p=11276</guid>
		<description><![CDATA[HEADER *************************************************************** #include&#60;stdio.h&#62; #include&#60;stdlib.h&#62; struct cq { int info; struct cq *next; }; int getchoice(); int operation(int, struct cq **, struct cq **, struct cq **); int enqueue( struct cq **, struct cq **, struct cq **); int display( struct &#8230; <a href="https://www.emblogic.com/blog/07/implementation-of-circular-queue-using-linked-list/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>HEADER</p>
<p>***************************************************************</p>
<p>#include&lt;stdio.h&gt;<br />
#include&lt;stdlib.h&gt;<br />
struct cq<br />
{<br />
int info;<br />
struct cq *next;<br />
};<br />
int getchoice();<br />
int operation(int, struct cq **, struct cq **, struct cq **);<br />
int enqueue( struct cq **, struct cq **, struct cq **);<br />
int display( struct cq **, struct cq **, struct cq **);<br />
int dequeue( struct cq **, struct cq **, struct cq **);</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>MAIN</p>
<p>***************************************************************</p>
<p>#include&#8221;header.h&#8221;<br />
int main()<br />
{<br />
struct cq *front = NULL , *rear = NULL, *start = NULL;<br />
int choice;<br />
while(1)<br />
{<br />
choice = getchoice();<br />
operation(choice,&amp;front,&amp;rear,&amp;start);<br />
}<br />
}</p>
<p>&nbsp;</p>
<p>DEFINITIONS</p>
<p>***********************************************************************</p>
<p>#include&#8221;header.h&#8221;<br />
int flag = 0,count = -1;<br />
int getchoice()<br />
{<br />
int choice;<br />
printf(&#8221;                   1.create\n&#8221;);<br />
printf(&#8221;                   2.enqueue\n&#8221;);<br />
printf(&#8221;                   3.dequeue\n&#8221;);<br />
printf(&#8221;                   4.display\n&#8221;);<br />
printf(&#8221;                   5.exit\n&#8221;);<br />
printf(&#8221;                Enter your choice\n&#8221;);<br />
scanf(&#8220;%d&#8221;,&amp;choice);<br />
return choice;<br />
}<br />
int operation(int choice, struct cq **front, struct cq **rear,struct cq **start)<br />
{<br />
int i,k;<br />
switch(choice)<br />
{<br />
case 1:    if(flag == 0)<br />
{<br />
printf(&#8220;successfully created!!\n&#8221;);<br />
flag = 1;<br />
}<br />
else<br />
printf(&#8220;already created\n&#8221;);<br />
break;<br />
case 2:{<br />
printf(&#8220;How many elments you want to enqueue?\n&#8221;);<br />
scanf(&#8220;%d&#8221;,&amp;k);<br />
if(k &gt; (10-(count+1)))<br />
{<br />
printf(&#8220;no sufficient space!! you can enter %d more elements\n&#8221;,10-(count+1));<br />
break;<br />
}<br />
for(i = 0; i &lt; k; i++)<br />
{<br />
enqueue(front,rear,start);<br />
}<br />
printf(&#8220;%d elements entered!!\n&#8221;,k);break;<br />
}<br />
case 3:{<br />
printf(&#8220;How many elments you want to dequeue?\n&#8221;);<br />
scanf(&#8220;%d&#8221;,&amp;k);<br />
if(k &gt; (count+1))<br />
{<br />
printf(&#8221; you can dequeue %d elements only\n&#8221;,(count+1));<br />
break;<br />
}<br />
for(i = 0; i &lt; k; i++)<br />
{<br />
dequeue(front,rear,start);<br />
}<br />
printf(&#8220;%d elements dequeued!!\n&#8221;,k);break;<br />
}<br />
case 4:display(front,rear,start);break;<br />
case 5:exit(0);<br />
default:printf(&#8220;invalid choice\n&#8221;);<br />
}<br />
}<br />
int dequeue(struct cq **front, struct cq **rear,struct cq **start)<br />
{<br />
struct cq *temp;<br />
if(flag == 0)<br />
{<br />
printf(&#8220;c queue not created!!\n&#8221;);<br />
return -1;;<br />
}<br />
if(count == -1)<br />
{<br />
printf(&#8220;c queue is empty(underflow)\n&#8221;);<br />
return 0;<br />
}<br />
if(!(*front))<br />
{<br />
temp = *start;<br />
*front = (*start)-&gt;next;<br />
printf(&#8220;%d is dequeued\n&#8221;,temp-&gt;info);<br />
free(temp);<br />
*start = NULL;<br />
count&#8211;;<br />
}<br />
else if(count == 0)<br />
{<br />
printf(&#8220;%d is dequeued\n&#8221;,(*front)-&gt;info);<br />
*front = *rear = NULL;<br />
count&#8211;;<br />
}</p>
<p>else if(count &gt; 0)<br />
{<br />
temp = *front;<br />
*front = (*front)-&gt;next;<br />
printf(&#8220;%d is dequeued\n&#8221;,temp-&gt;info);<br />
count&#8211;;<br />
}<br />
//    printf(&#8220;count: %d\n&#8221;,count);<br />
display(front,rear,start);</p>
<p>}<br />
int enqueue(struct cq **front, struct cq **rear,struct cq **start)<br />
{<br />
struct cq *temp;<br />
if(flag == 0)<br />
{<br />
printf(&#8220;queue not created!!\n&#8221;);<br />
return -1;;<br />
}<br />
if(count &gt;= 9)<br />
{<br />
printf(&#8220;c Queue is full!\n&#8221;);<br />
return 0;<br />
}<br />
if(!(*rear))<br />
{<br />
*rear = malloc(sizeof(struct cq));<br />
printf(&#8220;Enter the %d element\n&#8221;,count+1);<br />
scanf(&#8220;%d&#8221;,&amp;((*rear)-&gt;info));<br />
(*rear)-&gt;next = NULL;<br />
*start = *rear;<br />
}<br />
else if(rear)<br />
{<br />
temp = malloc(sizeof(struct cq));<br />
(*rear)-&gt;next = temp;<br />
*rear = (*rear)-&gt;next;<br />
printf(&#8220;Enter the %d element\n&#8221;,count+1);<br />
scanf(&#8220;%d&#8221;,&amp;(temp-&gt;info));<br />
(temp)-&gt;next = NULL;<br />
}<br />
count++;<br />
//    printf(&#8220;count: %d\n&#8221;,count);<br />
display(front,rear,start);<br />
}<br />
int display(struct cq **front, struct cq **rear,struct cq **start)<br />
{<br />
struct cq *temp;<br />
if(flag == 0)<br />
{<br />
printf(&#8220;queue not created!!\n&#8221;);<br />
return -1;;<br />
}<br />
if(!(*rear) &amp;&amp; !(*front))<br />
printf(&#8220;c queue is empty\n&#8221;);<br />
if(!(*front) &amp;&amp; *rear)<br />
temp = *start;<br />
else<br />
temp = *front;<br />
while(temp)<br />
{<br />
printf(&#8220;&lt;-%d&#8221;,temp-&gt;info);<br />
temp = temp-&gt;next;<br />
}<br />
printf(&#8220;\n&#8221;);<br />
}</p>
]]></content:encoded>
			<wfw:commentRss>https://www.emblogic.com/blog/07/implementation-of-circular-queue-using-linked-list/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>function to detect comon node in two linked lists and correct them.</title>
		<link>https://www.emblogic.com/blog/07/function-to-detect-comon-node-in-two-linked-lists-and-correct-them/</link>
		<comments>https://www.emblogic.com/blog/07/function-to-detect-comon-node-in-two-linked-lists-and-correct-them/#comments</comments>
		<pubDate>Mon, 21 Jul 2014 05:09:45 +0000</pubDate>
		<dc:creator><![CDATA[Harminder Singh]]></dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.emblogic.com/blog/?p=11206</guid>
		<description><![CDATA[int fix_cnode(struct node **start, struct node **start1) { struct node *temp,**ma,*temp1; int count = 0,i,flag =1; temp = *start; ma = calloc(sizeof(struct node *),20); while(1) { flag = 1; if(!(temp-&#62;next)) { printf(&#8220;there is no loop\n&#8221;); goto o; } for(i=0; i&#60;count; &#8230; <a href="https://www.emblogic.com/blog/07/function-to-detect-comon-node-in-two-linked-lists-and-correct-them/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>int fix_cnode(struct node **start, struct node **start1)<br />
{<br />
struct node *temp,**ma,*temp1;<br />
int count = 0,i,flag =1;<br />
temp = *start;<br />
ma = calloc(sizeof(struct node *),20);<br />
while(1)<br />
{<br />
flag = 1;<br />
if(!(temp-&gt;next))<br />
{<br />
printf(&#8220;there is no loop\n&#8221;);<br />
goto o;<br />
}<br />
for(i=0; i&lt;count; i++)<br />
{<br />
if(temp-&gt;next == *(ma+i))<br />
flag = 0;<br />
break;</p>
<p>}<br />
if(flag == 1)<br />
{<br />
*(ma+(count)) = temp;<br />
printf(&#8220;%d\n&#8221;,*(ma+count));<br />
count++;<br />
}<br />
printf(&#8221;                            count = %d\n&#8221;,count);<br />
temp = temp-&gt;next;</p>
<p>}<br />
o:        temp = *start1;<br />
for(i = 0; i&lt;count; i++)<br />
{<br />
if(temp-&gt;next == *(ma+i))<br />
break;<br />
temp = temp-&gt;next;<br />
}<br />
printf(&#8220;common node is detected at %d\n&#8221;,temp-&gt;next-&gt;info);<br />
temp -&gt;next= NULL;<br />
return 0;</p>
<p>}</p>
]]></content:encoded>
			<wfw:commentRss>https://www.emblogic.com/blog/07/function-to-detect-comon-node-in-two-linked-lists-and-correct-them/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>function to detect a loop in linked list and remove the loop.</title>
		<link>https://www.emblogic.com/blog/07/program-to-detect-a-loop-in-linked-list-and-remove-the-loop/</link>
		<comments>https://www.emblogic.com/blog/07/program-to-detect-a-loop-in-linked-list-and-remove-the-loop/#comments</comments>
		<pubDate>Mon, 21 Jul 2014 05:02:10 +0000</pubDate>
		<dc:creator><![CDATA[Harminder Singh]]></dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.emblogic.com/blog/?p=11203</guid>
		<description><![CDATA[int fix_loop(struct node **start)// pass start as a pass by reference argument { struct node *temp,**ma; int count = 0,i; temp = *start; ma = calloc(sizeof(struct node *),20); while(1) { if(!(temp-&#62;next)) { printf(&#8220;there is no loop\n&#8221;); return -1; } for(i=0; &#8230; <a href="https://www.emblogic.com/blog/07/program-to-detect-a-loop-in-linked-list-and-remove-the-loop/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>int fix_loop(struct node **start)// pass start as a pass by reference argument<br />
{<br />
struct node *temp,**ma;<br />
int count = 0,i;<br />
temp = *start;<br />
ma = calloc(sizeof(struct node *),20);<br />
while(1)<br />
{<br />
if(!(temp-&gt;next))<br />
{<br />
printf(&#8220;there is no loop\n&#8221;);<br />
return -1;<br />
}<br />
for(i=0; i&lt;count; i++)<br />
{<br />
if(temp-&gt;next == *(ma+i))// create a master array which contains all the unique addresses<br />
goto o;<br />
//            printf(&#8220;i = %d\n&#8221;,i);</p>
<p>}<br />
printf(&#8221;                            count = %d\n&#8221;,count);<br />
*(ma+(count)) = temp;<br />
count++;<br />
//        ma = realloc(ma,count+1);<br />
temp = temp-&gt;next;</p>
<p>}<br />
o:    temp-&gt;next= NULL;<br />
printf(&#8220;loop!! fixed\n&#8221;);<br />
free(ma);<br />
return 0;<br />
}</p>
]]></content:encoded>
			<wfw:commentRss>https://www.emblogic.com/blog/07/program-to-detect-a-loop-in-linked-list-and-remove-the-loop/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Program in c to print sin wave.</title>
		<link>https://www.emblogic.com/blog/07/program-in-c-to-print-sin-wave/</link>
		<comments>https://www.emblogic.com/blog/07/program-in-c-to-print-sin-wave/#comments</comments>
		<pubDate>Thu, 17 Jul 2014 04:19:14 +0000</pubDate>
		<dc:creator><![CDATA[Harminder Singh]]></dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.emblogic.com/blog/?p=11055</guid>
		<description><![CDATA[#include&#60;stdio.h&#62; #include&#60;math.h&#62; int main() { double a,b,i; int j; int count=0; a=22.0/7.0; for(i=0.0; i &#60;= 4.0; i+=0.1) { b= sin(a*i)+ cos(a*i); if(b &#62;= 0) { printf(&#8221;          &#8220;); for(j =10*b;j &#62;= 0.0; j-=1.0) { printf(&#8221; &#8220;); } } if(b &#60; 0.0) &#8230; <a href="https://www.emblogic.com/blog/07/program-in-c-to-print-sin-wave/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>#include&lt;stdio.h&gt;<br />
#include&lt;math.h&gt;<br />
int main()<br />
{<br />
double a,b,i;<br />
int j;<br />
int count=0;<br />
a=22.0/7.0;<br />
for(i=0.0; i &lt;= 4.0; i+=0.1)<br />
{<br />
b= sin(a*i)+ cos(a*i);<br />
if(b &gt;= 0)<br />
{<br />
printf(&#8221;          &#8220;);<br />
for(j =10*b;j &gt;= 0.0; j-=1.0)<br />
{<br />
printf(&#8221; &#8220;);<br />
}<br />
}<br />
if(b &lt; 0.0)<br />
{<br />
for(j=10 +(10*b);j&gt;=0.0;j-=1.0)<br />
{<br />
printf(&#8221; &#8220;);<br />
}<br />
}<br />
printf(&#8220;*\n&#8221;);</p>
<p>}<br />
return 0;<br />
}</p>
<p>********************************************************************************************</p>
]]></content:encoded>
			<wfw:commentRss>https://www.emblogic.com/blog/07/program-in-c-to-print-sin-wave/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>a program to read all text files in current directory and merge them all into one text file (assignment13 q6) using</title>
		<link>https://www.emblogic.com/blog/07/a-program-to-read-all-text-files-in-current-directory-and-merge-them-all-into-one-text-file-assignment13-q6-using/</link>
		<comments>https://www.emblogic.com/blog/07/a-program-to-read-all-text-files-in-current-directory-and-merge-them-all-into-one-text-file-assignment13-q6-using/#comments</comments>
		<pubDate>Mon, 14 Jul 2014 05:44:07 +0000</pubDate>
		<dc:creator><![CDATA[Harminder Singh]]></dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.emblogic.com/blog/?p=10962</guid>
		<description><![CDATA[#include&#60;stdio.h&#62; #include&#60;fcntl.h&#62; #include&#60;dirent.h&#62; #include&#60;string.h&#62; int openf(char *); int main() { DIR *i; struct dirent *k; int j,l,s,flag=1,fd,fd1; char *m = &#8220;txt.&#8221;; char ch; fd1 = openf(&#8220;new.txt&#8221;); i = opendir(&#8220;./test&#8221;); printf(&#8220;\n%d\n&#8221;,i); while(( k = readdir(i)) !=  NULL) { flag=1; l=strlen(k-&#62;d_name); for(j &#8230; <a href="https://www.emblogic.com/blog/07/a-program-to-read-all-text-files-in-current-directory-and-merge-them-all-into-one-text-file-assignment13-q6-using/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>#include&lt;stdio.h&gt;<br />
#include&lt;fcntl.h&gt;<br />
#include&lt;dirent.h&gt;<br />
#include&lt;string.h&gt;<br />
int openf(char *);<br />
int main()<br />
{<br />
DIR *i;<br />
struct dirent *k;<br />
int j,l,s,flag=1,fd,fd1;<br />
char *m = &#8220;txt.&#8221;;<br />
char ch;<br />
fd1 = openf(&#8220;new.txt&#8221;);<br />
i = opendir(&#8220;./test&#8221;);<br />
printf(&#8220;\n%d\n&#8221;,i);</p>
<p>while(( k = readdir(i)) !=  NULL)<br />
{<br />
flag=1;<br />
l=strlen(k-&gt;d_name);<br />
for(j = l-1,s=0;j &gt;= l-4,s &lt; 4 ;j&#8211;,s++ )<br />
{<br />
if((k-&gt;d_name[j])!= m[s])<br />
{<br />
flag=0;<br />
goto q;<br />
}</p>
<p>}<br />
q:         if(flag==1)<br />
{<br />
fd = openf(k-&gt;d_name);<br />
while(read(fd, &amp;ch, 1))<br />
write(fd1,&amp;ch,1);<br />
close(fd);<br />
}<br />
}<br />
printf(&#8220;\n&#8221;);<br />
close(fd1);<br />
}<br />
int openf(char * s)<br />
{<br />
int fd;<br />
fd = open(s,O_RDWR|O_CREAT,0666);<br />
if(fd &lt; 1)<br />
perror(&#8220;open error&#8221;);<br />
else<br />
printf(&#8220;input file open succesfull fd = %d\n&#8221;,fd);<br />
return fd;<br />
}</p>
]]></content:encoded>
			<wfw:commentRss>https://www.emblogic.com/blog/07/a-program-to-read-all-text-files-in-current-directory-and-merge-them-all-into-one-text-file-assignment13-q6-using/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A function foo(int fd, char * buff , int n, int b_size, int skip) that reads to buff from file where file descriptor fd , n blocks of size b_size each , the last argument specifies the number of bits to skip after each block.</title>
		<link>https://www.emblogic.com/blog/07/a-function-fooint-fd-char-buff-int-n-int-b_size-int-skip-that-reads-to-buff-from-file-where-file-descriptor-fd-n-blocks-of-size-b_size-each-the-last-argument-specifies-the-number-of-bits/</link>
		<comments>https://www.emblogic.com/blog/07/a-function-fooint-fd-char-buff-int-n-int-b_size-int-skip-that-reads-to-buff-from-file-where-file-descriptor-fd-n-blocks-of-size-b_size-each-the-last-argument-specifies-the-number-of-bits/#comments</comments>
		<pubDate>Mon, 14 Jul 2014 05:23:34 +0000</pubDate>
		<dc:creator><![CDATA[Harminder Singh]]></dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.emblogic.com/blog/?p=10960</guid>
		<description><![CDATA[#include&#60;stdio.h&#62; #include&#60;fcntl.h&#62; #include&#60;stdlib.h&#62; int foo(int ,  char *, int , int , int, char *); int openf( char *); int main(int argc, char * argv[]) { int fd,pos,skip,b_size,n; char ch,*buff; buff = (char*)malloc(sizeof(char)); printf(&#8220;\nBlock size: &#8220;); scanf(&#8220;%d&#8221;,&#38;b_size); printf(&#8220;\nNumber of Blocks: &#8230; <a href="https://www.emblogic.com/blog/07/a-function-fooint-fd-char-buff-int-n-int-b_size-int-skip-that-reads-to-buff-from-file-where-file-descriptor-fd-n-blocks-of-size-b_size-each-the-last-argument-specifies-the-number-of-bits/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>#include&lt;stdio.h&gt;<br />
#include&lt;fcntl.h&gt;<br />
#include&lt;stdlib.h&gt;<br />
int foo(int ,  char *, int , int , int, char *);<br />
int openf( char *);<br />
int main(int argc, char * argv[])<br />
{<br />
int fd,pos,skip,b_size,n;<br />
char ch,*buff;<br />
buff = (char*)malloc(sizeof(char));<br />
printf(&#8220;\nBlock size: &#8220;);<br />
scanf(&#8220;%d&#8221;,&amp;b_size);<br />
printf(&#8220;\nNumber of Blocks: &#8220;);<br />
scanf(&#8220;%d&#8221;,&amp;n);<br />
printf(&#8220;\nBytes to be skiped after each block: &#8220;);<br />
scanf(&#8220;%d&#8221;,&amp;skip);<br />
fd = openf(argv[1]);<br />
foo(fd,buff,b_size,n,skip,argv[1]);<br />
close(fd);<br />
}<br />
int foo(int fd,  char *buff, int b_size, int n, int skip ,char * f)<br />
{<br />
char ch;<br />
int i=0,j=0,k=0,m=0;<br />
printf(&#8220;\nPHASE ONE DONE!!\n&#8221;);<br />
while(1)<br />
{<br />
i=0;<br />
for(j=0;;j++)<br />
{    if(j&gt;=n)goto i;<br />
for(k=0; k &lt; b_size; k++)<br />
{<br />
if (!(read(fd, &amp;ch, 1)) || ch==0)<br />
i:    goto o;<br />
*(buff+k) = ch;<br />
buff = realloc(buff,k+1);<br />
}<br />
for(m=0;m &lt; skip;m++)<br />
read(fd, &amp;ch, 1);</p>
<p>printf(&#8220;\n%s**\n&#8221;,buff);<br />
free(buff);<br />
buff = (char*)malloc(sizeof(char));<br />
}</p>
<p>}<br />
o:printf(&#8220;\n%d blocks of size %d skipping %d bits after each read  are read form file %s\n&#8221;,n,b_size,skip,f);</p>
<p>}<br />
int openf(char * s)<br />
{<br />
int fd;<br />
fd = open(s,O_RDWR|O_CREAT,0666);<br />
if(fd &lt; 1)<br />
perror(&#8220;open error&#8221;);<br />
else<br />
printf(&#8220;input file open succesfull fd = %d\n&#8221;,fd);<br />
return fd;<br />
}</p>
]]></content:encoded>
			<wfw:commentRss>https://www.emblogic.com/blog/07/a-function-fooint-fd-char-buff-int-n-int-b_size-int-skip-that-reads-to-buff-from-file-where-file-descriptor-fd-n-blocks-of-size-b_size-each-the-last-argument-specifies-the-number-of-bits/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>program to make a 4gb file with free space. file with holes.</title>
		<link>https://www.emblogic.com/blog/07/program-to-make-a-4gb-file-with-free-space-file-with-holes/</link>
		<comments>https://www.emblogic.com/blog/07/program-to-make-a-4gb-file-with-free-space-file-with-holes/#comments</comments>
		<pubDate>Sun, 13 Jul 2014 05:43:08 +0000</pubDate>
		<dc:creator><![CDATA[Harminder Singh]]></dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.emblogic.com/blog/?p=10952</guid>
		<description><![CDATA[#include&#60;stdio.h&#62; #include&#60;fcntl.h&#62; int openf(char *); int main(int argc, char * argv[]) { int fd,fd1, pos,i=1000000; char ch=&#8221;; fd = openf(argv[1]); pos = lseek(fd,i * 4096, SEEK_SET); write(fd, &#38;ch,1); close(fd); } int openf(char * s) { int fd; fd = open(s,O_RDWR&#124;O_CREAT,0666); &#8230; <a href="https://www.emblogic.com/blog/07/program-to-make-a-4gb-file-with-free-space-file-with-holes/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>#include&lt;stdio.h&gt;<br />
#include&lt;fcntl.h&gt;<br />
int openf(char *);<br />
int main(int argc, char * argv[])<br />
{<br />
int fd,fd1, pos,i=1000000;<br />
char ch=&#8221;;<br />
fd = openf(argv[1]);<br />
pos = lseek(fd,i * 4096, SEEK_SET);<br />
write(fd, &amp;ch,1);<br />
close(fd);<br />
}<br />
int openf(char * s)<br />
{<br />
int fd;<br />
fd = open(s,O_RDWR|O_CREAT,0666);<br />
if(fd &lt; 1)<br />
perror(&#8220;open error&#8221;);<br />
else<br />
printf(&#8220;input file open succesfull fd = %d\n&#8221;,fd);<br />
return fd;<br />
}</p>
]]></content:encoded>
			<wfw:commentRss>https://www.emblogic.com/blog/07/program-to-make-a-4gb-file-with-free-space-file-with-holes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>program to read text from a file and store it in reverse order</title>
		<link>https://www.emblogic.com/blog/07/program-to-read-text-from-a-file-and-store-it-in-reverse-order/</link>
		<comments>https://www.emblogic.com/blog/07/program-to-read-text-from-a-file-and-store-it-in-reverse-order/#comments</comments>
		<pubDate>Sun, 13 Jul 2014 05:26:33 +0000</pubDate>
		<dc:creator><![CDATA[Harminder Singh]]></dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.emblogic.com/blog/?p=10950</guid>
		<description><![CDATA[#include&#60;stdio.h&#62; #include&#60;fcntl.h&#62; int openf(char *); int main(int argc, char * argv[]) { int fd,fd1, pos,i=3; char ch; fd = openf(argv[1]); fd1 = openf(argv[2]); pos = lseek(fd, 0, SEEK_END); printf(&#8220;\n%d\n&#8221;,pos); for(i=2; i &#60; pos+1;i++) { lseek(fd, pos-i, SEEK_SET); read(fd, &#38;ch, 1); &#8230; <a href="https://www.emblogic.com/blog/07/program-to-read-text-from-a-file-and-store-it-in-reverse-order/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>#include&lt;stdio.h&gt;<br />
#include&lt;fcntl.h&gt;<br />
int openf(char *);<br />
int main(int argc, char * argv[])<br />
{<br />
int fd,fd1, pos,i=3;<br />
char ch;<br />
fd = openf(argv[1]);<br />
fd1 = openf(argv[2]);<br />
pos = lseek(fd, 0, SEEK_END);<br />
printf(&#8220;\n%d\n&#8221;,pos);<br />
for(i=2; i &lt; pos+1;i++)<br />
{<br />
lseek(fd, pos-i, SEEK_SET);<br />
read(fd, &amp;ch, 1);<br />
write(fd1, &amp;ch, 1);<br />
printf(&#8220;ch = %c\n&#8221;,ch);<br />
}</p>
<p>close(fd);<br />
close(fd1);<br />
}<br />
int openf(char * s)<br />
{<br />
int fd;<br />
fd = open(s,O_RDWR|O_CREAT,0666);<br />
if(fd &lt; 1)<br />
perror(&#8220;open error&#8221;);<br />
else<br />
printf(&#8220;input file open succesfull fd = %d\n&#8221;,fd);<br />
return fd;<br />
}</p>
]]></content:encoded>
			<wfw:commentRss>https://www.emblogic.com/blog/07/program-to-read-text-from-a-file-and-store-it-in-reverse-order/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>adding two distances in feet and inches using functions and structure pointers</title>
		<link>https://www.emblogic.com/blog/07/adding-two-distances-in-feet-and-inches-using-functions-and-structure-pointers/</link>
		<comments>https://www.emblogic.com/blog/07/adding-two-distances-in-feet-and-inches-using-functions-and-structure-pointers/#comments</comments>
		<pubDate>Fri, 11 Jul 2014 09:53:15 +0000</pubDate>
		<dc:creator><![CDATA[Harminder Singh]]></dc:creator>
				<category><![CDATA[Data Structures with C]]></category>
		<category><![CDATA[Project 2: Multiple Data Compression and Encryption]]></category>

		<guid isPermaLink="false">http://www.emblogic.com/blog/?p=10913</guid>
		<description><![CDATA[header file********************************************************************* #include&#60;stdio.h&#62; #include&#60;stdlib.h&#62; struct distance {    int feet; int inches; }; int display(struct distance *,struct distance *,struct distance *); struct distance * add(struct distance *,struct distance *); struct distance * input(); ************************************************************************** main file****************************************************************** #include&#8221;header.h&#8221; int main() { struct &#8230; <a href="https://www.emblogic.com/blog/07/adding-two-distances-in-feet-and-inches-using-functions-and-structure-pointers/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>header file*********************************************************************</p>
<p>#include&lt;stdio.h&gt;<br />
#include&lt;stdlib.h&gt;</p>
<p>struct distance<br />
{    int feet;<br />
int inches;<br />
};<br />
int display(struct distance *,struct distance *,struct distance *);<br />
struct distance * add(struct distance *,struct distance *);<br />
struct distance * input();</p>
<p>**************************************************************************</p>
<p>main file******************************************************************</p>
<p>#include&#8221;header.h&#8221;<br />
int main()<br />
{<br />
struct distance *d1,*d2,*d3;<br />
d1 = input();<br />
d2 = input();<br />
d3 = add(d1,d2);<br />
display(d1,d2,d3);<br />
return 0;</p>
<p>}<br />
struct distance * input()<br />
{<br />
struct distance *d1;<br />
d1 = (struct distance*)malloc(sizeof(struct distance));<br />
printf(&#8220;\nenter the distance in feet&#8221;);<br />
scanf(&#8220;%d&#8221;,&amp;d1-&gt;feet);<br />
printf(&#8220;\nenter the distance in inches&#8221;);<br />
scanf(&#8220;%d&#8221;,&amp;d1-&gt;inches);<br />
return d1;</p>
<p>}<br />
struct distance * add(struct distance *d1, struct distance *d2)<br />
{<br />
struct distance *d3;<br />
d3 = (struct distance*)malloc(sizeof(struct distance));<br />
d3-&gt;inches= d1-&gt;inches +d2-&gt;inches;<br />
d3-&gt;feet = d1-&gt;feet +d2-&gt;feet;<br />
if(d3-&gt;inches &gt;= 12)<br />
{    d3-&gt;feet++;<br />
d3-&gt;inches-=12;<br />
}<br />
return d3;</p>
<p>}<br />
int display(struct distance *d1,struct distance *d2,struct distance *d3)<br />
{<br />
printf(&#8221; %d\&#8217; %d\&#8221; \n %d\&#8217; %d\&#8221; \n &#8212;&#8212; \n%d\&#8217; %d\&#8221; \n &#8220;,d1-&gt;feet,d1-&gt;inches,d2-&gt;feet,d2-&gt;inches,d3-&gt;feet,d3-&gt;inches);<br />
}<br />
****************************************************************************</p>
<p>output:::</p>
<p>enter the distance in feet6</p>
<p>enter the distance in inches7</p>
<p>enter the distance in feet6</p>
<p>enter the distance in inches7<br />
6&#8242; 7&#8243;<br />
6&#8242; 7&#8243;<br />
&#8212;&#8212;<br />
13&#8242; 2&#8243;</p>
]]></content:encoded>
			<wfw:commentRss>https://www.emblogic.com/blog/07/adding-two-distances-in-feet-and-inches-using-functions-and-structure-pointers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
