
{"id":15954,"date":"2014-09-16T15:29:45","date_gmt":"2014-09-16T15:29:45","guid":{"rendered":"http:\/\/www.beautifulwork.org\/?p=15954"},"modified":"2014-09-16T15:29:45","modified_gmt":"2014-09-16T15:29:45","slug":"how-to-write-a-program-to-swap-values","status":"publish","type":"post","link":"https:\/\/www.trueangle.org\/index.php\/2014\/09\/16\/how-to-write-a-program-to-swap-values\/","title":{"rendered":"How to write an algorithm to swap values ?"},"content":{"rendered":"<pre>\n\/* part of work copied from http:\/\/www.sanfoundry.com\/c-program-swap-values\/ *\/\n#include &lt;stdio.h&gt;\n\nswap_values()\n{\nint temp;\nint *ptr1, *ptr2;\nint a, b;\nprintf(\"Enter integer values to be swapped: \");\nscanf(\"%d %d\",&amp;a,&amp;b);\nptr1 = &amp;a;\nptr2 = &amp;b;\ntemp = *ptr1;\n*ptr1 = *ptr2;\n*ptr2 = temp;\nprintf(\"Swapped values are: %d %d \\n\",a,b);\n}\n\n\/* http:\/\/www.programmingsimplified.com\/c-program-swap-two-numbers *\/\n\/* http:\/\/betterexplained.com\/articles\/swap-two-variables-using-xor\/ *\/\n\/* http:\/\/www.science.unitn.it\/~fiorella\/guidelinux\/tlk\/node27.html *\/\n\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\/* part of work copied from http:\/\/www.sanfoundry.com\/c-program-swap-values\/ *\/ #include &lt;stdio.h&gt; swap_values() { int temp; int *ptr1, *ptr2; int a, b; printf(&#8220;Enter integer values to be swapped: &#8220;); scanf(&#8220;%d %d&#8221;,&amp;a,&amp;b); ptr1 = &amp;a; ptr2 = &amp;b; temp = *ptr1; *ptr1 = *ptr2; *ptr2 = temp; printf(&#8220;Swapped values are: %d %d \\n&#8221;,a,b); } \/* http:\/\/www.programmingsimplified.com\/c-program-swap-two-numbers *\/ \/* &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.trueangle.org\/index.php\/2014\/09\/16\/how-to-write-a-program-to-swap-values\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;How to write an algorithm to swap values ?&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[141,21,83,91],"tags":[],"_links":{"self":[{"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/posts\/15954"}],"collection":[{"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/comments?post=15954"}],"version-history":[{"count":0,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/posts\/15954\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/media?parent=15954"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/categories?post=15954"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/tags?post=15954"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}