<br />
<b>Warning</b>:  Undefined array key "global_protection_id" in <b>/home/wikitechy/public_html/interview-questions/wp-content/plugins/content-protector/inc/class-ps-rest-handler.php</b> on line <b>51</b><br />
{"id":335,"date":"2021-07-12T20:50:02","date_gmt":"2021-07-12T20:50:02","guid":{"rendered":"https:\/\/www.wikitechy.com\/interview-questions\/?p=335"},"modified":"2021-09-14T05:56:29","modified_gmt":"2021-09-14T05:56:29","slug":"explain-call-by-reference-in-c-language","status":"publish","type":"post","link":"https:\/\/www.wikitechy.com\/interview-questions\/c\/explain-call-by-reference-in-c-language\/","title":{"rendered":"Explain Call by Reference in C language ?"},"content":{"rendered":"<h2 id=\"explain-call-by-reference-in-c-language\" class=\"color-pink\" style=\"text-align: justify;\">Explain Call by Reference in C language ?<\/h2>\n<div class=\"subheading\" style=\"text-align: justify;\">\n<h2 id=\"call-by-value\">Call by value<\/h2>\n<\/div>\n<div class=\"Content\" style=\"text-align: justify;\">\n<div class=\"hddn\">\n<ul>\n<li>In call by reference, original value is modified because we pass reference (address).<\/li>\n<li>Here, address of the value is passed in the function, so actual and formal arguments shares the same address space. Hence, value changed inside the function, is reflected inside as well as outside the function.<\/li>\n<\/ul>\n<\/div>\n<\/div>\n<div class=\"text-center row\" style=\"text-align: justify;\"><\/div>\n<div class=\"subheading\" style=\"text-align: justify;\">\n<h2 id=\"sample-code\" class=\"color-green\">Sample Code<\/h2>\n<div class=\"code-embed-wrapper\"> <div class=\"code-embed-infos\"> <\/div> <pre class=\"language-c code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-c code-embed-code\">#include&lt;stdio.h&gt;<br\/>void change(int *num) <br\/>{    <br\/>    printf(&quot;Before adding value inside function num=%d \\n&quot;,*num);    <br\/>    (*num) += 100;    <br\/>    printf(&quot;After adding value inside function num=%d \\n&quot;, *num);    <br\/>}      <br\/>int main() <br\/>{    <br\/>    int x=100;    <br\/>    printf(&quot;Before function call x=%d \\n&quot;, x);    <br\/>    change(&amp;x);    <br\/>    printf(&quot;After function call x=%d \\n&quot;, x);    <br\/>    return 0;  <br\/>} <\/code><\/pre> <\/div>\n<div class=\"TextHeading\">\n<div class=\"hddn\">\n<h2 id=\"output\" class=\"color-green\">Output<\/h2>\n<div class=\"code-embed-wrapper\"> <div class=\"code-embed-infos\"> <\/div> <pre class=\"language-c code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-c code-embed-code\">Before function call x=100<br\/>Before adding value inside function num=100<br\/>After adding value inside function num=200<br\/>After function call x=200<\/code><\/pre> <\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Answer : In call by reference, original value is modified&#8230;<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"passster_activate_protection":false,"passster_protect_child_pages":"","passster_protection_type":"password","passster_password":"","passster_activate_overwrite_defaults":"","passster_headline":"","passster_instruction":"","passster_placeholder":"","passster_button":"","passster_id":"","passster_activate_misc_settings":"","passster_redirect_url":"","passster_hide":"no","passster_area_shortcode":"","gtb_hide_title":false,"gtb_wrap_title":false,"gtb_class_title":"","gtb_remove_headerfooter":false,"footnotes":""},"categories":[1716],"tags":[1739,491,1740,211,1955,1956,1965,1957,1958,1959,1960,1966,1947,1936,1961,1949,1962,203,199,214,198,363,209,1968,205,1745,1948,1942,1743,222,1963,1747,196,212,710,207,366,204,217,15927,288,1744,483,206,1741,1742,1746,1967,1964],"class_list":["post-335","post","type-post","status-publish","format-standard","hentry","category-c","tag-accentur-interview-questions-and-answers","tag-applied-materials-interview-questions-and-answers","tag-asian-paints-ltd-interview-questions-and-answers","tag-bosch-india-software-interview-questions-and-answers","tag-c-call-by-reference-using-pointers","tag-c-function-call-by-reference","tag-call-by-reference","tag-call-by-reference-definition","tag-call-by-reference-example-c-program","tag-call-by-reference-in-c-without-pointers","tag-call-by-reference-in-c","tag-call-by-reference-in-java","tag-call-by-value-and-call-by-reference","tag-call-by-value-and-call-by-reference-in-c","tag-call-by-value-and-call-by-reference-in-c-with-example","tag-call-by-value-and-call-by-reference-in-java","tag-call-by-vlaue","tag-capgemini-interview-questions-and-answers","tag-casting-networks-india-pvt-limited-interview-questions-and-answers","tag-cgi-group-inc-interview-questions-and-answers","tag-chetu-interview-questions-and-answers","tag-ciena-corporation-interview-questions-and-answers","tag-collabera-technologies-interview-questions-and-answers","tag-define-call-by-reference","tag-dell-international-services-india-pvt-ltd-interview-questions-and-answers","tag-dhfl-pramerica-life-insurance-company-ltd-interview-questions-and-answers","tag-difference-between-call-by-value-and-call-by-reference","tag-difference-between-call-by-value-and-reference-in-c","tag-elico-healthcare-services-ltd-interview-questions-and-answers","tag-flipkart-interview-questions-and-answers","tag-function-call-by-reference-in-c","tag-hcl-technol-interview-questions-and-answers","tag-ibm-interview-questions-and-answers","tag-indecomm-global-services-interview-questions-and-answers","tag-mavenir-interview-questions-and-answers","tag-mphasis-interview-questions-and-answers","tag-netapp-interview-questions-and-answers","tag-oracle-corporation-interview-questions-and-answers","tag-peoplestrong-interview-questions-and-answers","tag-plintron-interview-questions-and-answers","tag-r-systems-interview-questions-and-answers","tag-raqmiyat-information-technologies-pvt-ltd-interview-questions-and-answers","tag-reliance-industries-ltd-interview-questions-and-answers","tag-sap-labs-india-pvt-ltd-interview-questions-and-answers","tag-tata-aia-life-insurance-interview-questions-and-answers","tag-tech-mahindr-interview-questions-and-answers","tag-the-linde-group-interview-questions-and-answers","tag-what-is-call-by-reference","tag-what-is-function-call-by-reference"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v22.6 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Explain Call by Reference in C language ? - C Interview Questions<\/title>\n<meta name=\"description\" content=\"Explain Call by Reference in C language ? - C Interview Questions - In call by reference, original value is modified because we pass reference (address).\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wikitechy.com\/interview-questions\/c\/explain-call-by-reference-in-c-language\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Explain Call by Reference in C language ? - C Interview Questions\" \/>\n<meta property=\"og:description\" content=\"Explain Call by Reference in C language ? - C Interview Questions - In call by reference, original value is modified because we pass reference (address).\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wikitechy.com\/interview-questions\/c\/explain-call-by-reference-in-c-language\/\" \/>\n<meta property=\"og:site_name\" content=\"Wikitechy\" \/>\n<meta property=\"article:published_time\" content=\"2021-07-12T20:50:02+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-09-14T05:56:29+00:00\" \/>\n<meta name=\"author\" content=\"Editor\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Editor\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wikitechy.com\/interview-questions\/c\/explain-call-by-reference-in-c-language\/\",\"url\":\"https:\/\/www.wikitechy.com\/interview-questions\/c\/explain-call-by-reference-in-c-language\/\",\"name\":\"Explain Call by Reference in C language ? - C Interview Questions\",\"isPartOf\":{\"@id\":\"https:\/\/www.wikitechy.com\/interview-questions\/#website\"},\"datePublished\":\"2021-07-12T20:50:02+00:00\",\"dateModified\":\"2021-09-14T05:56:29+00:00\",\"author\":{\"@id\":\"https:\/\/www.wikitechy.com\/interview-questions\/#\/schema\/person\/4d5a581fb5470d1560324bddc5e8b757\"},\"description\":\"Explain Call by Reference in C language ? - C Interview Questions - In call by reference, original value is modified because we pass reference (address).\",\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wikitechy.com\/interview-questions\/c\/explain-call-by-reference-in-c-language\/\"]}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wikitechy.com\/interview-questions\/#website\",\"url\":\"https:\/\/www.wikitechy.com\/interview-questions\/\",\"name\":\"Wikitechy\",\"description\":\"Interview Questions\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wikitechy.com\/interview-questions\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wikitechy.com\/interview-questions\/#\/schema\/person\/4d5a581fb5470d1560324bddc5e8b757\",\"name\":\"Editor\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.wikitechy.com\/interview-questions\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/e9531079fe7e07841b7b156c04d65e5f39d4adfd18b6ffe3edfff8ca5aab85b5?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/e9531079fe7e07841b7b156c04d65e5f39d4adfd18b6ffe3edfff8ca5aab85b5?s=96&d=mm&r=g\",\"caption\":\"Editor\"},\"url\":\"https:\/\/www.wikitechy.com\/interview-questions\/author\/editor\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Explain Call by Reference in C language ? - C Interview Questions","description":"Explain Call by Reference in C language ? - C Interview Questions - In call by reference, original value is modified because we pass reference (address).","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wikitechy.com\/interview-questions\/c\/explain-call-by-reference-in-c-language\/","og_locale":"en_US","og_type":"article","og_title":"Explain Call by Reference in C language ? - C Interview Questions","og_description":"Explain Call by Reference in C language ? - C Interview Questions - In call by reference, original value is modified because we pass reference (address).","og_url":"https:\/\/www.wikitechy.com\/interview-questions\/c\/explain-call-by-reference-in-c-language\/","og_site_name":"Wikitechy","article_published_time":"2021-07-12T20:50:02+00:00","article_modified_time":"2021-09-14T05:56:29+00:00","author":"Editor","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Editor","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wikitechy.com\/interview-questions\/c\/explain-call-by-reference-in-c-language\/","url":"https:\/\/www.wikitechy.com\/interview-questions\/c\/explain-call-by-reference-in-c-language\/","name":"Explain Call by Reference in C language ? - C Interview Questions","isPartOf":{"@id":"https:\/\/www.wikitechy.com\/interview-questions\/#website"},"datePublished":"2021-07-12T20:50:02+00:00","dateModified":"2021-09-14T05:56:29+00:00","author":{"@id":"https:\/\/www.wikitechy.com\/interview-questions\/#\/schema\/person\/4d5a581fb5470d1560324bddc5e8b757"},"description":"Explain Call by Reference in C language ? - C Interview Questions - In call by reference, original value is modified because we pass reference (address).","inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wikitechy.com\/interview-questions\/c\/explain-call-by-reference-in-c-language\/"]}]},{"@type":"WebSite","@id":"https:\/\/www.wikitechy.com\/interview-questions\/#website","url":"https:\/\/www.wikitechy.com\/interview-questions\/","name":"Wikitechy","description":"Interview Questions","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wikitechy.com\/interview-questions\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.wikitechy.com\/interview-questions\/#\/schema\/person\/4d5a581fb5470d1560324bddc5e8b757","name":"Editor","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.wikitechy.com\/interview-questions\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/e9531079fe7e07841b7b156c04d65e5f39d4adfd18b6ffe3edfff8ca5aab85b5?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/e9531079fe7e07841b7b156c04d65e5f39d4adfd18b6ffe3edfff8ca5aab85b5?s=96&d=mm&r=g","caption":"Editor"},"url":"https:\/\/www.wikitechy.com\/interview-questions\/author\/editor\/"}]}},"_links":{"self":[{"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/posts\/335","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/comments?post=335"}],"version-history":[{"count":3,"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/posts\/335\/revisions"}],"predecessor-version":[{"id":3645,"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/posts\/335\/revisions\/3645"}],"wp:attachment":[{"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/media?parent=335"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/categories?post=335"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/tags?post=335"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}