{"id":11695,"date":"2023-01-18T04:49:20","date_gmt":"2023-01-18T04:49:20","guid":{"rendered":"https:\/\/www.prepbytes.com\/blog\/?p=11695"},"modified":"2023-06-06T13:17:05","modified_gmt":"2023-06-06T13:17:05","slug":"what-is-string-in-c","status":"publish","type":"post","link":"https:\/\/prepbytes.com\/blog\/what-is-string-in-c\/","title":{"rendered":"What is String in C?"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1673871044889-string%20in%20c.jpg\" alt=\"\" \/><\/p>\n<p>The definition of  C string , how to declare a string, string definition in C and what is string in C language are all covered in this article. With examples, it goes over the many ways to initialize strings. It discusses how to read text from a user and how to read text with whitespace. Also addressed is how to represent strings as pointers and send them to functions. It covers what we learned in the article by going over an example of a C String. Finally, it compares and contrasts character arrays and string literals.<\/p>\n<h2>String in C Language?<\/h2>\n<p>Strings are useful for communicating information from the program to the program user and, thus, are a part of all programming languages and applications. They are implemented with character arrays that behave like usual arrays with which we can perform regular operations, including modification. Another way of implementing strings is through pointers since character arrays act as pointers. These pointers point to string literals and cannot be modified as string literals are stored in the read-only memory by most compilers. Thus, any attempt at modifying them leads to undefined behavior.<\/p>\n<h3>String Definition in C<\/h3>\n<p>A string is a group of characters, such as letters, numbers, symbols, and punctuation marks, that are arranged in a linear fashion. A string in C is a group of characters that is finished with the NULL character &quot;0.&quot; For instance:<\/p>\n<pre><code>char str[] = \"PrepBytes.\\0\";<\/code><\/pre>\n<p>Like many other programming languages, C encloses strings in double quotes (&quot;&quot;) while enclosing characters in single quotes (&#8221;). A null character (\\0) is automatically added at the conclusion when the compiler discovers a string of characters contained in double quotation marks.<\/p>\n<p>So, the string is stored in this way:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1673871045017-string%20in%20c1.png\" alt=\"\" \/><\/p>\n<p>A group of zero or more multibyte characters surrounded in double quotes, such as &quot;abc,&quot; is referred to as a string literal. String literals cannot be changed (and are placed in read-only memory). Any attempt to change their values leads to behavior that is undefined.<\/p>\n<h3>How to Declare String in C<\/h3>\n<p>A character-based array known as a String in the C programming language. In contrast to other programming languages like C++, C does not natively provide the string data type. Therefore, in order to show a string in C, character arrays are required. Declaring a string in C generally looks like this:<\/p>\n<pre><code>char variable[array_size];<\/code><\/pre>\n<p>Consequently, the traditional declaration can be expressed as follows::<\/p>\n<pre><code>char str[5];\nchar str2[50];<\/code><\/pre>\n<p>We must always take into consideration the extra space that the null letter (\\0) occupies.<\/p>\n<p><strong>Highlights<\/strong><br \/>\nIn C, strings are declared using character arrays.<br \/>\nTheir general syntax is as follows:<\/p>\n<pre><code>char variable[array_size];<\/code><\/pre>\n<h3>Initializing C String<\/h3>\n<p>There are four methods of initializing a string in C:<\/p>\n<p><strong>1. Assigning a string literal with size<\/strong><br \/>\nDirectly assigning a string literal to a character array is possible as long as the array size is at least one greater than the string literal original length.<\/p>\n<p><strong>Note:<\/strong> The null character requires one additional space, therefore we must always take it into consideration when calculating the initial size. Setting the initial size to be n+1 will allow us to store a string of size n.<br \/>\n<strong>For example:<\/strong><\/p>\n<pre><code>char str[8] = \"PrepBytes.\";<\/code><\/pre>\n<p>Although this string should be 10 characters long, we kept the size at 11 to include the Null character. The Null character (\\0) is automatically added at the end by the compiler.<\/p>\n<p><strong>Note:<\/strong> If the string is too long for the array, it only accepts characters based on available space. For instance:<\/p>\n<pre><code>char str[3] = \"PREPBYTES.\";\nprintf(\"%s\",str);<\/code><\/pre>\n<p><strong>Output<\/strong><\/p>\n<pre><code>PRE<\/code><\/pre>\n<p><strong>2. Assigning a string literal without size<\/strong><br \/>\nAnother option is to simply assign a string literal with no size to a character array. At compile time, the compiler automatically calculates the size.<\/p>\n<pre><code>char str[] = \"PREPBYTES\";<\/code><\/pre>\n<p>The important thing to keep in mind is that because this string is an array and is called &quot;str,&quot; it functions as a pointer.<\/p>\n<p><strong>3. Assigning character by character with size<\/strong><br \/>\nA string can also be assigned character per character. But it&#8217;s crucial to set the final character to be &#8216;0&#8217;. For instance:<\/p>\n<pre><code>char str[11] = {'P', 'R', 'E', 'P', 'B', 'Y', \u2018T\u2019, \u2018E\u2019, \u2018S\u2019, '.','\\0'};<\/code><\/pre>\n<p><strong>4. Assigning character by character without size<\/strong><br \/>\nWe also assign character by character with the Null Character at the end, similar to assigning straight without regard to size. The length of the string will be determined automatically by the compiler.<\/p>\n<pre><code>char str[] = {{'P', 'R', 'E', 'P', 'B', 'Y', \u2018T\u2019, \u2018E\u2019, \u2018S\u2019, '.','\\0'};<\/code><\/pre>\n<p><img decoding=\"async\" src=\"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1673871045017-string%20in%20c2.png\" alt=\"\" \/><\/p>\n<p><strong>Highlights:<\/strong> There are four methods of initializing a string in C:<br \/>\n<strong>1. Assigning a string literal with size.<\/strong><br \/>\n<strong>2. Assigning a string literal without size.<\/strong><br \/>\n<strong>3. Assigning character by character with size.<\/strong><br \/>\n<strong>4. Assigning character by character without size.<\/strong><\/p>\n<h3>Assign Value to Strings<\/h3>\n<p>Once they have been declared, character arrays cannot be given a string literal using the &#8216;=&#8217; operator.<\/p>\n<pre><code>char str[100];\nstr = \"String.\";<\/code><\/pre>\n<p>Since assignment operations are not supported after strings are declared, this will result in a compilation error. We can utilize the following two techniques to overcome this:<\/p>\n<ol>\n<li>While initializing it, as described above, assign the value to a character array.<\/li>\n<li>\n<p>The value we want to add to the character array can be copied using the strcpy() function. The following is the strcpy() syntax:<br \/>\nstrcpy(char<em> destination, const char<\/em> source);<br \/>\nThe string pointed by the source is copied to the destination, along with the null character. For instance:<\/p>\n<p>char str[20];<br \/>\nstrcpy(str,&quot;Strings.&quot;);<br \/>\nThis gives the string its assigned value.<\/p>\n<\/li>\n<\/ol>\n<p><strong>Note &#8211;<\/strong> Making sure the value assigned has a length that is less than or equal to the character array&#8217;s maximum size.<\/p>\n<p><strong>Highlights:<\/strong><\/p>\n<ol>\n<li>Once they have been declared, character arrays cannot be given a string literal using the &#8216;=&#8217; operator.<\/li>\n<li>Both initialization time and the strcpy() function can be used for assignment.<\/li>\n<\/ol>\n<h3>Read String from the User<\/h3>\n<p>Scanf(), the most popular method for reading strings, reads a string of characters until it runs into whitespace (i.e., space, newline, tab, etc.). The process of accepting input with whitespace is described in the section that follows. For instance,<\/p>\n<pre><code>char str[25];\nscanf(\"%s\", str);<\/code><\/pre>\n<p>If we enter the following input:<\/p>\n<pre><code>PrepBytes is amazing.<\/code><\/pre>\n<p>We obtain the following Output:<\/p>\n<pre><code>PrepBytes<\/code><\/pre>\n<p>As we can see, once it detects whitespace, scanf() stops accepting input.<\/p>\n<p><strong>Note &#8211;<\/strong><\/p>\n<ol>\n<li>In C, %s is the format specifier that is used to input and output strings.<\/li>\n<li>You may have noticed that the variable&#8217;s name is typically prefixed by a &amp; operator when using scanf(). This is not the case in this instance since the character array&#8217;s character pointer points to the address of the array&#8217;s first character. Therefore, there is no need to employ the address operator(&amp;).<br \/>\n<strong>Highlights:<\/strong> In C, scanf() can be used to read strings. But it only reads till it hits a whitespace.<\/li>\n<\/ol>\n<h3>How to Read a Line of Text?<\/h3>\n<p>As it automatically stops reading when it encounters whitespace, the scanf() operation cannot read strings that contain spaces. By combining fgets() with puts(), we can read and print strings with whitespace:<\/p>\n<ul>\n<li><strong>fgets()<\/strong> An array of characters can be read using the fgets() method. Its statement is as follows:<br \/>\nfgets(name_of_string, number_of_characters, stdin);<br \/>\n*<em>name_of_string<\/em>:<strong> It is the variable where the string will be kept. <\/strong>number_of_characters:<strong> You should read the string&#8217;s maximum length. <\/strong>stdin:** The string needs to be read from the filehandle in this case.<\/li>\n<li><strong>puts():<\/strong> The function puts() makes it easy to show strings.<br \/>\nputs(name_of_string);<\/li>\n<\/ul>\n<p><strong>name_of_string:<\/strong> It is the variable that will hold the string.<\/p>\n<p>Using both functions as an example:<br \/>\n\t\t\t\t\t\t<style>\r\n\t\t\t\t\r\n\t\t\t\t\t#tab_container_11649 {\r\n\toverflow:hidden;\r\n\tdisplay:block;\r\n\twidth:100%;\r\n\tborder:0px solid #ddd;\r\n\tmargin-bottom:30px;\r\n\t}\r\n\r\n#tab_container_11649 .tab-content{\r\n\tpadding:20px;\r\n\tborder: 1px solid #e6e6e6 !important;\r\n\tmargin-top: 0px;\r\n\tbackground-color:#ffffff !important;\r\n\tcolor: #000000 !important;\r\n\tfont-size:16px !important;\r\n\tfont-family: Open Sans !important;\r\n\t\r\n\t\tborder: 1px solid #e6e6e6 !important;\r\n\t}\r\n#tab_container_11649 .wpsm_nav-tabs {\r\n    border-bottom: 0px solid #ddd;\r\n}\r\n#tab_container_11649 .wpsm_nav-tabs > li.active > a, #tab_container_11649 .wpsm_nav-tabs > li.active > a:hover, #tab_container_11649 .wpsm_nav-tabs > li.active > a:focus {\r\n\tcolor: #000000 !important;\r\n\tcursor: default;\r\n\tbackground-color: #ffffff !important;\r\n\tborder: 1px solid #e6e6e6 !important;\r\n}\r\n\r\n#tab_container_11649 .wpsm_nav-tabs > li > a {\r\n    margin-right: 0px !important; \r\n    line-height: 1.42857143 !important;\r\n    border: 1px solid #d5d5d5 !important;\r\n    border-radius: 0px 0px 0 0 !important; \r\n\tbackground-color: #e8e8e8 !important;\r\n\tcolor: #000000 !important;\r\n\tpadding: 15px 18px 15px 18px !important;\r\n\ttext-decoration: none !important;\r\n\tfont-size: 14px !important;\r\n\ttext-align:center !important;\r\n\tfont-family: Open Sans !important;\r\n}\r\n#tab_container_11649 .wpsm_nav-tabs > li > a:focus {\r\noutline: 0px !important;\r\n}\r\n\r\n#tab_container_11649 .wpsm_nav-tabs > li > a:before {\r\n\tdisplay:none !important;\r\n}\r\n#tab_container_11649 .wpsm_nav-tabs > li > a:after {\r\n\tdisplay:none !important ;\r\n}\r\n#tab_container_11649 .wpsm_nav-tabs > li{\r\npadding:0px !important ;\r\nmargin:0px;\r\n}\r\n\r\n#tab_container_11649 .wpsm_nav-tabs > li > a:hover , #tab_container_11649 .wpsm_nav-tabs > li > a:focus {\r\n    color: #000000 !important;\r\n    background-color: #e8e8e8 !important;\r\n\tborder: 1px solid #d5d5d5 !important;\r\n\t\r\n}\r\n#tab_container_11649 .wpsm_nav-tabs > li > a .fa{\r\n\r\nmargin-right:5px !important;\r\n\r\nmargin-left:5px !important;\r\n\r\n\r\n}\r\n\r\n\t\t#tab_container_11649 .wpsm_nav-tabs a{\r\n\t\t\tbackground-image: none;\r\n\t\t\tbackground-position: 0 0;\r\n\t\t\tbackground-repeat: repeat-x;\r\n\t\t}\r\n\t\t\t\r\n\r\n\r\n#tab_container_11649 .wpsm_nav-tabs > li {\r\n    float: left;\r\n    margin-bottom: -1px !important;\r\n\tmargin-right:0px !important; \r\n}\r\n\r\n\r\n#tab_container_11649 .tab-content{\r\noverflow:hidden !important;\r\n}\r\n\r\n\r\n@media (min-width: 769px) {\r\n\r\n\t#tab_container_11649 .wpsm_nav-tabs > li{\r\n\t\tfloat:left !important ;\r\n\t\t\t\tmargin-right:-1px !important;\r\n\t\t\t\t\t}\r\n\t#tab_container_11649 .wpsm_nav-tabs{\r\n\t\tfloat:none !important;\r\n\t\tmargin:0px !important;\r\n\t}\r\n\r\n\t#tab_container_11649 .wpsm_nav-tabs > li {\r\n\t\t\t\t\r\n\t}\r\n\t#tab_container_11649 .wpsm_nav{\r\n\t\t\t}\r\n\r\n}\r\n\r\n\r\n\r\n@media (max-width: 768px) {\r\n\t#tab_container_11649 .wpsm_nav-tabs > li {\r\n\t\t\t\t\r\n\t}\r\n\t#tab_container_11649 .wpsm_nav{\r\n\t\t\t}\r\n}\r\n\r\n\r\n\t.wpsm_nav-tabs li:before{\r\n\t\tdisplay:none !important;\r\n\t}\r\n\r\n\t@media (max-width: 768px) {\r\n\t\t\t\t\r\n\t\t\t\t.wpsm_nav-tabs{\r\n\t\t\tmargin-left:0px !important;\r\n\t\t\tmargin-right:0px !important; \r\n\t\t\t\r\n\t\t}\r\n\t\t\t\t#tab_container_11649 .wpsm_nav-tabs > li{\r\n\t\t\tfloat:none !important;\r\n\t\t}\r\n\t\t\t\r\n\t}\t\t\t\t<\/style>\r\n\t\t\t\t<div id=\"tab_container_11649\" >\r\n\t \r\n\t\t\t\t\t<ul class=\"wpsm_nav wpsm_nav-tabs\" role=\"tablist\" id=\"myTab_11649\">\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t<li role=\"presentation\"  class=\"active\"  onclick=\"do_resize()\">\r\n\t\t\t\t\t\t\t\t<a href=\"#tabs_desc_11649_1\" aria-controls=\"tabs_desc_11649_1\" role=\"tab\" data-toggle=\"tab\">\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<i class=\"fa fa-code\"><\/i> \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t<span>C<\/span>\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t<\/a>\r\n\t\t\t\t\t\t\t<\/li>\r\n\t\t\t\t\t\t\t\t\t\t\t <\/ul>\r\n\r\n\t\t\t\t\t  <!-- Tab panes -->\r\n\t\t\t\t\t  <div class=\"tab-content\" id=\"tab-content_11649\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t <div role=\"tabpanel\" class=\"tab-pane  in active \" id=\"tabs_desc_11649_1\">\r\n\t\t\t\t\t\t\t\t<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"c\">#include &lt;stdlib.h&gt;\r\n#include &lt;stdio.h&gt;\r\n\r\nint main() {\r\n  char str[30];\r\n  printf(\"Enter string: \");\r\n  fgets(str, sizeof(str), stdin);\r\n  printf(\"The string is: \");\r\n  puts(str);\r\n\r\n  return 0;\r\n}\r\n<\/pre>\t\t\t\t\t\t <\/div>\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t <\/div>\r\n\t\t\t\t\t \r\n\t\t\t\t <\/div>\r\n <script>\r\n\t\tjQuery(function () {\r\n\t\t\tjQuery('#myTab_11649 a:first').tab('show')\r\n\t\t});\r\n\t\t\r\n\t\t\t\tjQuery(function(){\r\n\t\t\tvar b=\"fadeIn\";\r\n\t\t\tvar c;\r\n\t\t\tvar a;\r\n\t\t\td(jQuery(\"#myTab_11649 a\"),jQuery(\"#tab-content_11649\"));function d(e,f,g){\r\n\t\t\t\te.click(function(i){\r\n\t\t\t\t\ti.preventDefault();\r\n\t\t\t\t\tjQuery(this).tab(\"show\");\r\n\t\t\t\t\tvar h=jQuery(this).data(\"easein\");\r\n\t\t\t\t\tif(c){c.removeClass(a);}\r\n\t\t\t\t\tif(h){f.find(\"div.active\").addClass(\"animated \"+h);a=h;}\r\n\t\t\t\t\telse{if(g){f.find(\"div.active\").addClass(\"animated \"+g);a=g;}else{f.find(\"div.active\").addClass(\"animated \"+b);a=b;}}c=f.find(\"div.active\");\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t});\r\n\t\t\r\n\r\n\t\tfunction do_resize(){\r\n\r\n\t\t\tvar width=jQuery( '.tab-content .tab-pane iframe' ).width();\r\n\t\t\tvar height=jQuery( '.tab-content .tab-pane iframe' ).height();\r\n\r\n\t\t\tvar toggleSize = true;\r\n\t\t\tjQuery('iframe').animate({\r\n\t\t\t    width: toggleSize ? width : 640,\r\n\t\t\t    height: toggleSize ? height : 360\r\n\t\t\t  }, 250);\r\n\r\n\t\t\t  toggleSize = !toggleSize;\r\n\t\t}\r\n\r\n\r\n\t<\/script>\r\n\t\t\t\t\r\n\t\t\t<\/p>\n<p><strong>Input<\/strong><\/p>\n<pre><code>Learn Coding From PrepBytes<\/code><\/pre>\n<p><strong>Output<\/strong><\/p>\n<pre><code>The string is: Learn Coding From PrepBytes<\/code><\/pre>\n<p>The strength of fgets() and puts() is shown in the above example, where we can see that the entire string, including the whitespace, was stored and printed.<\/p>\n<p><strong>Highlights:<\/strong><\/p>\n<ol>\n<li>To solve the issue of reading a line of text with whitespace, fgets() and puts() are combined.<\/li>\n<li>Syntax for fgets():<br \/>\nfgets(name_of_string, number_of_characters, stdin);<\/li>\n<li>Syntax for puts():<br \/>\nputs(name_of_string);<\/li>\n<\/ol>\n<h2>Passing Strings to Functions<\/h2>\n<p>Strings can be passed to functions in the same way that we give an array to a function, whether as an array or as a pointer, since they are just character arrays. Let&#8217;s examine this using the following program:<br \/>\n\t\t\t\t\t\t<style>\r\n\t\t\t\t\r\n\t\t\t\t\t#tab_container_11650 {\r\n\toverflow:hidden;\r\n\tdisplay:block;\r\n\twidth:100%;\r\n\tborder:0px solid #ddd;\r\n\tmargin-bottom:30px;\r\n\t}\r\n\r\n#tab_container_11650 .tab-content{\r\n\tpadding:20px;\r\n\tborder: 1px solid #e6e6e6 !important;\r\n\tmargin-top: 0px;\r\n\tbackground-color:#ffffff !important;\r\n\tcolor: #000000 !important;\r\n\tfont-size:16px !important;\r\n\tfont-family: Open Sans !important;\r\n\t\r\n\t\tborder: 1px solid #e6e6e6 !important;\r\n\t}\r\n#tab_container_11650 .wpsm_nav-tabs {\r\n    border-bottom: 0px solid #ddd;\r\n}\r\n#tab_container_11650 .wpsm_nav-tabs > li.active > a, #tab_container_11650 .wpsm_nav-tabs > li.active > a:hover, #tab_container_11650 .wpsm_nav-tabs > li.active > a:focus {\r\n\tcolor: #000000 !important;\r\n\tcursor: default;\r\n\tbackground-color: #ffffff !important;\r\n\tborder: 1px solid #e6e6e6 !important;\r\n}\r\n\r\n#tab_container_11650 .wpsm_nav-tabs > li > a {\r\n    margin-right: 0px !important; \r\n    line-height: 1.42857143 !important;\r\n    border: 1px solid #d5d5d5 !important;\r\n    border-radius: 0px 0px 0 0 !important; \r\n\tbackground-color: #e8e8e8 !important;\r\n\tcolor: #000000 !important;\r\n\tpadding: 15px 18px 15px 18px !important;\r\n\ttext-decoration: none !important;\r\n\tfont-size: 14px !important;\r\n\ttext-align:center !important;\r\n\tfont-family: Open Sans !important;\r\n}\r\n#tab_container_11650 .wpsm_nav-tabs > li > a:focus {\r\noutline: 0px !important;\r\n}\r\n\r\n#tab_container_11650 .wpsm_nav-tabs > li > a:before {\r\n\tdisplay:none !important;\r\n}\r\n#tab_container_11650 .wpsm_nav-tabs > li > a:after {\r\n\tdisplay:none !important ;\r\n}\r\n#tab_container_11650 .wpsm_nav-tabs > li{\r\npadding:0px !important ;\r\nmargin:0px;\r\n}\r\n\r\n#tab_container_11650 .wpsm_nav-tabs > li > a:hover , #tab_container_11650 .wpsm_nav-tabs > li > a:focus {\r\n    color: #000000 !important;\r\n    background-color: #e8e8e8 !important;\r\n\tborder: 1px solid #d5d5d5 !important;\r\n\t\r\n}\r\n#tab_container_11650 .wpsm_nav-tabs > li > a .fa{\r\n\r\nmargin-right:5px !important;\r\n\r\nmargin-left:5px !important;\r\n\r\n\r\n}\r\n\r\n\t\t#tab_container_11650 .wpsm_nav-tabs a{\r\n\t\t\tbackground-image: none;\r\n\t\t\tbackground-position: 0 0;\r\n\t\t\tbackground-repeat: repeat-x;\r\n\t\t}\r\n\t\t\t\r\n\r\n\r\n#tab_container_11650 .wpsm_nav-tabs > li {\r\n    float: left;\r\n    margin-bottom: -1px !important;\r\n\tmargin-right:0px !important; \r\n}\r\n\r\n\r\n#tab_container_11650 .tab-content{\r\noverflow:hidden !important;\r\n}\r\n\r\n\r\n@media (min-width: 769px) {\r\n\r\n\t#tab_container_11650 .wpsm_nav-tabs > li{\r\n\t\tfloat:left !important ;\r\n\t\t\t\tmargin-right:-1px !important;\r\n\t\t\t\t\t}\r\n\t#tab_container_11650 .wpsm_nav-tabs{\r\n\t\tfloat:none !important;\r\n\t\tmargin:0px !important;\r\n\t}\r\n\r\n\t#tab_container_11650 .wpsm_nav-tabs > li {\r\n\t\t\t\t\r\n\t}\r\n\t#tab_container_11650 .wpsm_nav{\r\n\t\t\t}\r\n\r\n}\r\n\r\n\r\n\r\n@media (max-width: 768px) {\r\n\t#tab_container_11650 .wpsm_nav-tabs > li {\r\n\t\t\t\t\r\n\t}\r\n\t#tab_container_11650 .wpsm_nav{\r\n\t\t\t}\r\n}\r\n\r\n\r\n\t.wpsm_nav-tabs li:before{\r\n\t\tdisplay:none !important;\r\n\t}\r\n\r\n\t@media (max-width: 768px) {\r\n\t\t\t\t\r\n\t\t\t\t.wpsm_nav-tabs{\r\n\t\t\tmargin-left:0px !important;\r\n\t\t\tmargin-right:0px !important; \r\n\t\t\t\r\n\t\t}\r\n\t\t\t\t#tab_container_11650 .wpsm_nav-tabs > li{\r\n\t\t\tfloat:none !important;\r\n\t\t}\r\n\t\t\t\r\n\t}\t\t\t\t<\/style>\r\n\t\t\t\t<div id=\"tab_container_11650\" >\r\n\t \r\n\t\t\t\t\t<ul class=\"wpsm_nav wpsm_nav-tabs\" role=\"tablist\" id=\"myTab_11650\">\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t<li role=\"presentation\"  class=\"active\"  onclick=\"do_resize()\">\r\n\t\t\t\t\t\t\t\t<a href=\"#tabs_desc_11650_1\" aria-controls=\"tabs_desc_11650_1\" role=\"tab\" data-toggle=\"tab\">\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<i class=\"fa fa-code\"><\/i> \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t<span>C<\/span>\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t<\/a>\r\n\t\t\t\t\t\t\t<\/li>\r\n\t\t\t\t\t\t\t\t\t\t\t <\/ul>\r\n\r\n\t\t\t\t\t  <!-- Tab panes -->\r\n\t\t\t\t\t  <div class=\"tab-content\" id=\"tab-content_11650\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t <div role=\"tabpanel\" class=\"tab-pane  in active \" id=\"tabs_desc_11650_1\">\r\n\t\t\t\t\t\t\t\t<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"c\">#include &lt;stdio.h&gt;\r\n\r\nvoid pointer(char * str) {\r\n  printf(\"The string is : \");\r\n  puts(str);\r\n  printf(\"&#92;n\");\r\n}\r\n\r\nvoid array(char str[]) {\r\n  printf(\"The string is : \");\r\n  puts(str);\r\n  printf(\"&#92;n\");\r\n}\r\n\r\nint main() {\r\n\r\n  char str[25] = \"PrepBytes is amazing.\";\r\n  pointer(str);\r\n  array(str);\r\n  return 0;\r\n}\r\n<\/pre>\t\t\t\t\t\t <\/div>\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t <\/div>\r\n\t\t\t\t\t \r\n\t\t\t\t <\/div>\r\n <script>\r\n\t\tjQuery(function () {\r\n\t\t\tjQuery('#myTab_11650 a:first').tab('show')\r\n\t\t});\r\n\t\t\r\n\t\t\t\tjQuery(function(){\r\n\t\t\tvar b=\"fadeIn\";\r\n\t\t\tvar c;\r\n\t\t\tvar a;\r\n\t\t\td(jQuery(\"#myTab_11650 a\"),jQuery(\"#tab-content_11650\"));function d(e,f,g){\r\n\t\t\t\te.click(function(i){\r\n\t\t\t\t\ti.preventDefault();\r\n\t\t\t\t\tjQuery(this).tab(\"show\");\r\n\t\t\t\t\tvar h=jQuery(this).data(\"easein\");\r\n\t\t\t\t\tif(c){c.removeClass(a);}\r\n\t\t\t\t\tif(h){f.find(\"div.active\").addClass(\"animated \"+h);a=h;}\r\n\t\t\t\t\telse{if(g){f.find(\"div.active\").addClass(\"animated \"+g);a=g;}else{f.find(\"div.active\").addClass(\"animated \"+b);a=b;}}c=f.find(\"div.active\");\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t});\r\n\t\t\r\n\r\n\t\tfunction do_resize(){\r\n\r\n\t\t\tvar width=jQuery( '.tab-content .tab-pane iframe' ).width();\r\n\t\t\tvar height=jQuery( '.tab-content .tab-pane iframe' ).height();\r\n\r\n\t\t\tvar toggleSize = true;\r\n\t\t\tjQuery('iframe').animate({\r\n\t\t\t    width: toggleSize ? width : 640,\r\n\t\t\t    height: toggleSize ? height : 360\r\n\t\t\t  }, 250);\r\n\r\n\t\t\t  toggleSize = !toggleSize;\r\n\t\t}\r\n\r\n\r\n\t<\/script>\r\n\t\t\t\t\r\n\t\t\t<\/p>\n<p><strong>Output<\/strong><\/p>\n<pre><code>The string is : PrepBytes is amazing.\nThe string is : PrepBytes is amazing.<\/code><\/pre>\n<p>As we can see, both of them yield the same Output.<br \/>\n<strong>Highlights:<\/strong> Functions may accept a string as a character array or even as a pointer.<\/p>\n<h2>Strings and Pointers<\/h2>\n<p>As we&#8217;ve seen, character arrays that function as pointers are used in C to represent strings. As a result, we can manipulate or even perform operations on the string using pointers.<br \/>\n\t\t\t\t\t\t<style>\r\n\t\t\t\t\r\n\t\t\t\t\t#tab_container_11651 {\r\n\toverflow:hidden;\r\n\tdisplay:block;\r\n\twidth:100%;\r\n\tborder:0px solid #ddd;\r\n\tmargin-bottom:30px;\r\n\t}\r\n\r\n#tab_container_11651 .tab-content{\r\n\tpadding:20px;\r\n\tborder: 1px solid #e6e6e6 !important;\r\n\tmargin-top: 0px;\r\n\tbackground-color:#ffffff !important;\r\n\tcolor: #000000 !important;\r\n\tfont-size:16px !important;\r\n\tfont-family: Open Sans !important;\r\n\t\r\n\t\tborder: 1px solid #e6e6e6 !important;\r\n\t}\r\n#tab_container_11651 .wpsm_nav-tabs {\r\n    border-bottom: 0px solid #ddd;\r\n}\r\n#tab_container_11651 .wpsm_nav-tabs > li.active > a, #tab_container_11651 .wpsm_nav-tabs > li.active > a:hover, #tab_container_11651 .wpsm_nav-tabs > li.active > a:focus {\r\n\tcolor: #000000 !important;\r\n\tcursor: default;\r\n\tbackground-color: #ffffff !important;\r\n\tborder: 1px solid #e6e6e6 !important;\r\n}\r\n\r\n#tab_container_11651 .wpsm_nav-tabs > li > a {\r\n    margin-right: 0px !important; \r\n    line-height: 1.42857143 !important;\r\n    border: 1px solid #d5d5d5 !important;\r\n    border-radius: 0px 0px 0 0 !important; \r\n\tbackground-color: #e8e8e8 !important;\r\n\tcolor: #000000 !important;\r\n\tpadding: 15px 18px 15px 18px !important;\r\n\ttext-decoration: none !important;\r\n\tfont-size: 14px !important;\r\n\ttext-align:center !important;\r\n\tfont-family: Open Sans !important;\r\n}\r\n#tab_container_11651 .wpsm_nav-tabs > li > a:focus {\r\noutline: 0px !important;\r\n}\r\n\r\n#tab_container_11651 .wpsm_nav-tabs > li > a:before {\r\n\tdisplay:none !important;\r\n}\r\n#tab_container_11651 .wpsm_nav-tabs > li > a:after {\r\n\tdisplay:none !important ;\r\n}\r\n#tab_container_11651 .wpsm_nav-tabs > li{\r\npadding:0px !important ;\r\nmargin:0px;\r\n}\r\n\r\n#tab_container_11651 .wpsm_nav-tabs > li > a:hover , #tab_container_11651 .wpsm_nav-tabs > li > a:focus {\r\n    color: #000000 !important;\r\n    background-color: #e8e8e8 !important;\r\n\tborder: 1px solid #d5d5d5 !important;\r\n\t\r\n}\r\n#tab_container_11651 .wpsm_nav-tabs > li > a .fa{\r\n\r\nmargin-right:5px !important;\r\n\r\nmargin-left:5px !important;\r\n\r\n\r\n}\r\n\r\n\t\t#tab_container_11651 .wpsm_nav-tabs a{\r\n\t\t\tbackground-image: none;\r\n\t\t\tbackground-position: 0 0;\r\n\t\t\tbackground-repeat: repeat-x;\r\n\t\t}\r\n\t\t\t\r\n\r\n\r\n#tab_container_11651 .wpsm_nav-tabs > li {\r\n    float: left;\r\n    margin-bottom: -1px !important;\r\n\tmargin-right:0px !important; \r\n}\r\n\r\n\r\n#tab_container_11651 .tab-content{\r\noverflow:hidden !important;\r\n}\r\n\r\n\r\n@media (min-width: 769px) {\r\n\r\n\t#tab_container_11651 .wpsm_nav-tabs > li{\r\n\t\tfloat:left !important ;\r\n\t\t\t\tmargin-right:-1px !important;\r\n\t\t\t\t\t}\r\n\t#tab_container_11651 .wpsm_nav-tabs{\r\n\t\tfloat:none !important;\r\n\t\tmargin:0px !important;\r\n\t}\r\n\r\n\t#tab_container_11651 .wpsm_nav-tabs > li {\r\n\t\t\t\t\r\n\t}\r\n\t#tab_container_11651 .wpsm_nav{\r\n\t\t\t}\r\n\r\n}\r\n\r\n\r\n\r\n@media (max-width: 768px) {\r\n\t#tab_container_11651 .wpsm_nav-tabs > li {\r\n\t\t\t\t\r\n\t}\r\n\t#tab_container_11651 .wpsm_nav{\r\n\t\t\t}\r\n}\r\n\r\n\r\n\t.wpsm_nav-tabs li:before{\r\n\t\tdisplay:none !important;\r\n\t}\r\n\r\n\t@media (max-width: 768px) {\r\n\t\t\t\t\r\n\t\t\t\t.wpsm_nav-tabs{\r\n\t\t\tmargin-left:0px !important;\r\n\t\t\tmargin-right:0px !important; \r\n\t\t\t\r\n\t\t}\r\n\t\t\t\t#tab_container_11651 .wpsm_nav-tabs > li{\r\n\t\t\tfloat:none !important;\r\n\t\t}\r\n\t\t\t\r\n\t}\t\t\t\t<\/style>\r\n\t\t\t\t<div id=\"tab_container_11651\" >\r\n\t \r\n\t\t\t\t\t<ul class=\"wpsm_nav wpsm_nav-tabs\" role=\"tablist\" id=\"myTab_11651\">\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t<li role=\"presentation\"  class=\"active\"  onclick=\"do_resize()\">\r\n\t\t\t\t\t\t\t\t<a href=\"#tabs_desc_11651_1\" aria-controls=\"tabs_desc_11651_1\" role=\"tab\" data-toggle=\"tab\">\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<i class=\"fa fa-code\"><\/i> \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t<span>C<\/span>\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t<\/a>\r\n\t\t\t\t\t\t\t<\/li>\r\n\t\t\t\t\t\t\t\t\t\t\t <\/ul>\r\n\r\n\t\t\t\t\t  <!-- Tab panes -->\r\n\t\t\t\t\t  <div class=\"tab-content\" id=\"tab-content_11651\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t <div role=\"tabpanel\" class=\"tab-pane  in active \" id=\"tabs_desc_11651_1\">\r\n\t\t\t\t\t\t\t\t<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"c\">#include &lt;stdlib.h&gt; \r\n#include &lt;stdio.h&gt;\r\n\r\nint main() {\r\n    char str[] = \"PrepBytess.\";\r\n    printf(\"%c\", *str); \/\/ Output: P\r\n    printf(\"%c\", *(str + 1)); \/\/ Output: r\r\n    printf(\"%c&#92;n\", *(str + 6)); \/\/ Output: t\r\n\r\n    char * stringPtr;\r\n    stringPtr = str;\r\n    printf(\"%c\", *stringPtr); \/\/ Output: P\r\n    printf(\"%c\", *(stringPtr + 1)); \/\/ Output: r\r\n    printf(\"%c\", *(stringPtr + 6)); \/\/ Output: t\r\n\r\n    return 0;\r\n}\r\n<\/pre>\t\t\t\t\t\t <\/div>\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t <\/div>\r\n\t\t\t\t\t \r\n\t\t\t\t <\/div>\r\n <script>\r\n\t\tjQuery(function () {\r\n\t\t\tjQuery('#myTab_11651 a:first').tab('show')\r\n\t\t});\r\n\t\t\r\n\t\t\t\tjQuery(function(){\r\n\t\t\tvar b=\"fadeIn\";\r\n\t\t\tvar c;\r\n\t\t\tvar a;\r\n\t\t\td(jQuery(\"#myTab_11651 a\"),jQuery(\"#tab-content_11651\"));function d(e,f,g){\r\n\t\t\t\te.click(function(i){\r\n\t\t\t\t\ti.preventDefault();\r\n\t\t\t\t\tjQuery(this).tab(\"show\");\r\n\t\t\t\t\tvar h=jQuery(this).data(\"easein\");\r\n\t\t\t\t\tif(c){c.removeClass(a);}\r\n\t\t\t\t\tif(h){f.find(\"div.active\").addClass(\"animated \"+h);a=h;}\r\n\t\t\t\t\telse{if(g){f.find(\"div.active\").addClass(\"animated \"+g);a=g;}else{f.find(\"div.active\").addClass(\"animated \"+b);a=b;}}c=f.find(\"div.active\");\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t});\r\n\t\t\r\n\r\n\t\tfunction do_resize(){\r\n\r\n\t\t\tvar width=jQuery( '.tab-content .tab-pane iframe' ).width();\r\n\t\t\tvar height=jQuery( '.tab-content .tab-pane iframe' ).height();\r\n\r\n\t\t\tvar toggleSize = true;\r\n\t\t\tjQuery('iframe').animate({\r\n\t\t\t    width: toggleSize ? width : 640,\r\n\t\t\t    height: toggleSize ? height : 360\r\n\t\t\t  }, 250);\r\n\r\n\t\t\t  toggleSize = !toggleSize;\r\n\t\t}\r\n\r\n\r\n\t<\/script>\r\n\t\t\t\t\r\n\t\t\t<\/p>\n<p><strong>Output<\/strong><\/p>\n<pre><code>Prt\nPrt<\/code><\/pre>\n<p><img decoding=\"async\" src=\"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1673871045036-string%20in%20c3.png\" alt=\"\" \/><\/p>\n<p><strong>Note:<\/strong> We can easily manipulate strings using pointers since character arrays behave like points.<\/p>\n<h2>C String Example<\/h2>\n<p>This program illustrates everything we learnt in this article, so check it out:<br \/>\n\t\t\t\t\t\t<style>\r\n\t\t\t\t\r\n\t\t\t\t\t#tab_container_11652 {\r\n\toverflow:hidden;\r\n\tdisplay:block;\r\n\twidth:100%;\r\n\tborder:0px solid #ddd;\r\n\tmargin-bottom:30px;\r\n\t}\r\n\r\n#tab_container_11652 .tab-content{\r\n\tpadding:20px;\r\n\tborder: 1px solid #e6e6e6 !important;\r\n\tmargin-top: 0px;\r\n\tbackground-color:#ffffff !important;\r\n\tcolor: #000000 !important;\r\n\tfont-size:16px !important;\r\n\tfont-family: Open Sans !important;\r\n\t\r\n\t\tborder: 1px solid #e6e6e6 !important;\r\n\t}\r\n#tab_container_11652 .wpsm_nav-tabs {\r\n    border-bottom: 0px solid #ddd;\r\n}\r\n#tab_container_11652 .wpsm_nav-tabs > li.active > a, #tab_container_11652 .wpsm_nav-tabs > li.active > a:hover, #tab_container_11652 .wpsm_nav-tabs > li.active > a:focus {\r\n\tcolor: #000000 !important;\r\n\tcursor: default;\r\n\tbackground-color: #ffffff !important;\r\n\tborder: 1px solid #e6e6e6 !important;\r\n}\r\n\r\n#tab_container_11652 .wpsm_nav-tabs > li > a {\r\n    margin-right: 0px !important; \r\n    line-height: 1.42857143 !important;\r\n    border: 1px solid #d5d5d5 !important;\r\n    border-radius: 0px 0px 0 0 !important; \r\n\tbackground-color: #e8e8e8 !important;\r\n\tcolor: #000000 !important;\r\n\tpadding: 15px 18px 15px 18px !important;\r\n\ttext-decoration: none !important;\r\n\tfont-size: 14px !important;\r\n\ttext-align:center !important;\r\n\tfont-family: Open Sans !important;\r\n}\r\n#tab_container_11652 .wpsm_nav-tabs > li > a:focus {\r\noutline: 0px !important;\r\n}\r\n\r\n#tab_container_11652 .wpsm_nav-tabs > li > a:before {\r\n\tdisplay:none !important;\r\n}\r\n#tab_container_11652 .wpsm_nav-tabs > li > a:after {\r\n\tdisplay:none !important ;\r\n}\r\n#tab_container_11652 .wpsm_nav-tabs > li{\r\npadding:0px !important ;\r\nmargin:0px;\r\n}\r\n\r\n#tab_container_11652 .wpsm_nav-tabs > li > a:hover , #tab_container_11652 .wpsm_nav-tabs > li > a:focus {\r\n    color: #000000 !important;\r\n    background-color: #e8e8e8 !important;\r\n\tborder: 1px solid #d5d5d5 !important;\r\n\t\r\n}\r\n#tab_container_11652 .wpsm_nav-tabs > li > a .fa{\r\n\r\nmargin-right:5px !important;\r\n\r\nmargin-left:5px !important;\r\n\r\n\r\n}\r\n\r\n\t\t#tab_container_11652 .wpsm_nav-tabs a{\r\n\t\t\tbackground-image: none;\r\n\t\t\tbackground-position: 0 0;\r\n\t\t\tbackground-repeat: repeat-x;\r\n\t\t}\r\n\t\t\t\r\n\r\n\r\n#tab_container_11652 .wpsm_nav-tabs > li {\r\n    float: left;\r\n    margin-bottom: -1px !important;\r\n\tmargin-right:0px !important; \r\n}\r\n\r\n\r\n#tab_container_11652 .tab-content{\r\noverflow:hidden !important;\r\n}\r\n\r\n\r\n@media (min-width: 769px) {\r\n\r\n\t#tab_container_11652 .wpsm_nav-tabs > li{\r\n\t\tfloat:left !important ;\r\n\t\t\t\tmargin-right:-1px !important;\r\n\t\t\t\t\t}\r\n\t#tab_container_11652 .wpsm_nav-tabs{\r\n\t\tfloat:none !important;\r\n\t\tmargin:0px !important;\r\n\t}\r\n\r\n\t#tab_container_11652 .wpsm_nav-tabs > li {\r\n\t\t\t\t\r\n\t}\r\n\t#tab_container_11652 .wpsm_nav{\r\n\t\t\t}\r\n\r\n}\r\n\r\n\r\n\r\n@media (max-width: 768px) {\r\n\t#tab_container_11652 .wpsm_nav-tabs > li {\r\n\t\t\t\t\r\n\t}\r\n\t#tab_container_11652 .wpsm_nav{\r\n\t\t\t}\r\n}\r\n\r\n\r\n\t.wpsm_nav-tabs li:before{\r\n\t\tdisplay:none !important;\r\n\t}\r\n\r\n\t@media (max-width: 768px) {\r\n\t\t\t\t\r\n\t\t\t\t.wpsm_nav-tabs{\r\n\t\t\tmargin-left:0px !important;\r\n\t\t\tmargin-right:0px !important; \r\n\t\t\t\r\n\t\t}\r\n\t\t\t\t#tab_container_11652 .wpsm_nav-tabs > li{\r\n\t\t\tfloat:none !important;\r\n\t\t}\r\n\t\t\t\r\n\t}\t\t\t\t<\/style>\r\n\t\t\t\t<div id=\"tab_container_11652\" >\r\n\t \r\n\t\t\t\t\t<ul class=\"wpsm_nav wpsm_nav-tabs\" role=\"tablist\" id=\"myTab_11652\">\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t<li role=\"presentation\"  class=\"active\"  onclick=\"do_resize()\">\r\n\t\t\t\t\t\t\t\t<a href=\"#tabs_desc_11652_1\" aria-controls=\"tabs_desc_11652_1\" role=\"tab\" data-toggle=\"tab\">\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<i class=\"fa fa-code\"><\/i> \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t<span>C<\/span>\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t<\/a>\r\n\t\t\t\t\t\t\t<\/li>\r\n\t\t\t\t\t\t\t\t\t\t\t <\/ul>\r\n\r\n\t\t\t\t\t  <!-- Tab panes -->\r\n\t\t\t\t\t  <div class=\"tab-content\" id=\"tab-content_11652\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t <div role=\"tabpanel\" class=\"tab-pane  in active \" id=\"tabs_desc_11652_1\">\r\n\t\t\t\t\t\t\t\t<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"c\">#include &lt;stdio.h&gt;\r\n\r\nvoid array(char str[]) {\r\n\r\n  printf(\"This function handles string literals with character arrays.&#92;n\");\r\n\r\n  printf(\"First character : %c&#92;n\", str[0]);\r\n\r\n  printf(\"The entire string is : %s&#92;n\", str);\r\n  str[0] = 'Q'; \/\/Here we have assigned the first element of the array to Q.\r\n\r\n  printf(\"The new string is : %s&#92;n\", str);\r\n}\r\n\r\nvoid literal(char * str) {\r\n\r\n  printf(\"This function handles string literals using pointers.&#92;n\");\r\n\r\n  printf(\"First character : %c&#92;n\", str[0]);\r\n\r\n  printf(\"The entire string is : %s&#92;n\", str);\r\n  \/\/ str[0] = 'Q';\r\n  \/\/Modification is not possible with string literals, since they are stored on the read-only memory.\r\n}\r\n\r\nint main() {\r\n  char str[] = \"Strings.\"; \/\/Here we have assigned the string literal to a character array.\r\n  array(str);\r\n  printf(\"&#92;n\");\r\n\r\n  char * strPtr = \"Strings.\"; \/\/\/\/Here we have assigned the string literal to a pointer.\r\n  literal(strPtr);\r\n\r\n  return 0;\r\n}\r\n<\/pre>\t\t\t\t\t\t <\/div>\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t <\/div>\r\n\t\t\t\t\t \r\n\t\t\t\t <\/div>\r\n <script>\r\n\t\tjQuery(function () {\r\n\t\t\tjQuery('#myTab_11652 a:first').tab('show')\r\n\t\t});\r\n\t\t\r\n\t\t\t\tjQuery(function(){\r\n\t\t\tvar b=\"fadeIn\";\r\n\t\t\tvar c;\r\n\t\t\tvar a;\r\n\t\t\td(jQuery(\"#myTab_11652 a\"),jQuery(\"#tab-content_11652\"));function d(e,f,g){\r\n\t\t\t\te.click(function(i){\r\n\t\t\t\t\ti.preventDefault();\r\n\t\t\t\t\tjQuery(this).tab(\"show\");\r\n\t\t\t\t\tvar h=jQuery(this).data(\"easein\");\r\n\t\t\t\t\tif(c){c.removeClass(a);}\r\n\t\t\t\t\tif(h){f.find(\"div.active\").addClass(\"animated \"+h);a=h;}\r\n\t\t\t\t\telse{if(g){f.find(\"div.active\").addClass(\"animated \"+g);a=g;}else{f.find(\"div.active\").addClass(\"animated \"+b);a=b;}}c=f.find(\"div.active\");\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t});\r\n\t\t\r\n\r\n\t\tfunction do_resize(){\r\n\r\n\t\t\tvar width=jQuery( '.tab-content .tab-pane iframe' ).width();\r\n\t\t\tvar height=jQuery( '.tab-content .tab-pane iframe' ).height();\r\n\r\n\t\t\tvar toggleSize = true;\r\n\t\t\tjQuery('iframe').animate({\r\n\t\t\t    width: toggleSize ? width : 640,\r\n\t\t\t    height: toggleSize ? height : 360\r\n\t\t\t  }, 250);\r\n\r\n\t\t\t  toggleSize = !toggleSize;\r\n\t\t}\r\n\r\n\r\n\t<\/script>\r\n\t\t\t\t\r\n\t\t\t<\/p>\n<p><strong>Output<\/strong><\/p>\n<pre><code>This function handles string literals with character arrays.\nFirst character : S\nThe entire string is : Strings.\nThe new string is : Qtrings.\n\nThis function handles string literals using pointers.\nFirst character : S\nThe entire string is : Strings.<\/code><\/pre>\n<h2>Difference Between Character Array and String Literal<\/h2>\n<p>Let&#8217;s review string literals before moving on to the distinction. A group of zero or more multibyte characters surrounded in double quotes, such as &quot;xyz,&quot; constitutes a string literal. String literals cannot be changed (and are placed in read-only memory). They behave in an ill-defined manner when you try to change their values.<\/p>\n<p>Arrays can be initialized using string literals. This has been demonstrated numerous times in the article. Let&#8217;s examine the differences now using the examples below:<\/p>\n<p><strong>1. char str[] = &quot;PREPBYTES.&quot;;<\/strong><br \/>\nWith this command, a character array that has a string literal attached to it is created. It operates like a typical array and allows for modification and other common operations. The only thing to keep in mind is that even though we only initialized 11 members, the size of the array is actually 12, since the compiler added the \\0 at the end.<\/p>\n<p>*<em>2. char <\/em>str  = &quot;PREPBYTES.&quot;;**<br \/>\nThe above statement generates a pointer that points to the string literal, specifically to the string literal&#8217;s first character. Now that we are aware that string literals are kept in a read-only memory region, we may conclude that modification is not allowed.<\/p>\n<p><strong>Note &#8211;<\/strong> It is defined to declare string literals as constants when printing them, such as:<\/p>\n<pre><code>const char *str = \"Strings.\";<\/code><\/pre>\n<p>This avoids the warning that appears when printf() is used with string literals.<\/p>\n<p><strong>Highlights:<\/strong><\/p>\n<ol>\n<li>Most compilers store string literals in their read-only memory section. As a result, they cannot be changed.<\/li>\n<li>We can modify character arrays as well as conduct other common operations on arrays.<\/li>\n<li>Just like string literals, pointers that point to them cannot be changed.<\/li>\n<\/ol>\n<p><strong>Conclusion<\/strong><br \/>\nIn this article, we have tried to cover C strings and how to declare strings in C in various ways. Just go through this article completely, you will surely get the idea of what is a string in C and how to declare a string in C.  Practicing string makes your coding skills stronger every day. <\/p>\n<h2>Frequently Asked Questions (FAQs)<\/h2>\n<p><strong>Q1. What is the definition of a C string?<\/strong><br \/>\nIn C, a string is a group of characters arranged in a linear fashion. It is implemented using character arrays or pointers to string literals. Strings are terminated with a null character (&#8216;\\0&#8217;).<\/p>\n<p><strong>Q2. How can I declare a string in C?<\/strong><br \/>\nIn C, strings are declared using character arrays. The general syntax for declaring a string is <code>char variableName[arraySize];<\/code>. For example, <code>char str[50];<\/code> declares a string variable named &quot;str&quot; with a maximum size of 50 characters.<\/p>\n<p><strong>Q3. What are the different ways to initialize strings in C?<\/strong><br \/>\nThere are several ways to initialize strings in C:<br \/>\nAssigning a string literal with a size: <code>char str[8] = &quot;PrepBytes.&quot;;<\/code><br \/>\nAssigning a string literal without a size: <code>char str[] = &quot;PREPBYTES&quot;;<\/code><br \/>\nAssigning character by character with a size: <code>char str[11] = {&#039;P&#039;, &#039;R&#039;, &#039;E&#039;, &#039;P&#039;, &#039;B&#039;, &#039;Y&#039;, &#039;T&#039;, &#039;E&#039;, &#039;S&#039;, &#039;.&#039;, &#039;\\0&#039;};<\/code><br \/>\nAssigning character by character without a size: <code>char str[] = {&#039;P&#039;, &#039;R&#039;, &#039;E&#039;, &#039;P&#039;, &#039;B&#039;, &#039;Y&#039;, &#039;T&#039;, &#039;E&#039;, &#039;S&#039;, &#039;.&#039;, &#039;\\0&#039;};<\/code><\/p>\n<p><strong>Q4.   How can I read a string from the user in C?<\/strong><br \/>\nTo read a string from the user in C, you can use the <code>scanf()<\/code> function with the <code>%s<\/code> format specifier. For example, <code>scanf(&quot;%s&quot;, str);<\/code> will read a string of characters until it encounters whitespace.<\/p>\n<p><strong>Q5.   Can strings be passed to functions in C?<\/strong><br \/>\nYes, strings can be passed to functions in C. Since strings are represented as character arrays or pointers, they can be passed as arguments to functions just like any other array. Functions can accept strings as character arrays or pointers.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The definition of C string , how to declare a string, string definition in C and what is string in C language are all covered in this article. With examples, it goes over the many ways to initialize strings. It discusses how to read text from a user and how to read text with whitespace. [&hellip;]<\/p>\n","protected":false},"author":52,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[2],"tags":[],"class_list":["post-11695","post","type-post","status-publish","format-standard","hentry","category-c-programming"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.8 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>What is String in C?<\/title>\n<meta name=\"description\" content=\"Here we will deep dive into C String. We will learn what is string in C, string definition in C, how to declare string in C, how to initialize C string.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/prepbytes.com\/blog\/what-is-string-in-c\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"What is String in C?\" \/>\n<meta property=\"og:description\" content=\"Here we will deep dive into C String. We will learn what is string in C, string definition in C, how to declare string in C, how to initialize C string.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/prepbytes.com\/blog\/what-is-string-in-c\/\" \/>\n<meta property=\"og:site_name\" content=\"PrepBytes Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/prepbytes0211\/\" \/>\n<meta property=\"article:published_time\" content=\"2023-01-18T04:49:20+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-06-06T13:17:05+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1673871044889-string%20in%20c.jpg\" \/>\n<meta name=\"author\" content=\"Prepbytes\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Prepbytes\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"9 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/prepbytes.com\/blog\/what-is-string-in-c\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/prepbytes.com\/blog\/what-is-string-in-c\/\"},\"author\":{\"name\":\"Prepbytes\",\"@id\":\"http:\/\/43.205.93.38\/#\/schema\/person\/3f7dc4ae851791d5947a7f99df363d5e\"},\"headline\":\"What is String in C?\",\"datePublished\":\"2023-01-18T04:49:20+00:00\",\"dateModified\":\"2023-06-06T13:17:05+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/prepbytes.com\/blog\/what-is-string-in-c\/\"},\"wordCount\":1963,\"commentCount\":0,\"publisher\":{\"@id\":\"http:\/\/43.205.93.38\/#organization\"},\"image\":{\"@id\":\"https:\/\/prepbytes.com\/blog\/what-is-string-in-c\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1673871044889-string%20in%20c.jpg\",\"articleSection\":[\"C Programming\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/prepbytes.com\/blog\/what-is-string-in-c\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/prepbytes.com\/blog\/what-is-string-in-c\/\",\"url\":\"https:\/\/prepbytes.com\/blog\/what-is-string-in-c\/\",\"name\":\"What is String in C?\",\"isPartOf\":{\"@id\":\"http:\/\/43.205.93.38\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/prepbytes.com\/blog\/what-is-string-in-c\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/prepbytes.com\/blog\/what-is-string-in-c\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1673871044889-string%20in%20c.jpg\",\"datePublished\":\"2023-01-18T04:49:20+00:00\",\"dateModified\":\"2023-06-06T13:17:05+00:00\",\"description\":\"Here we will deep dive into C String. We will learn what is string in C, string definition in C, how to declare string in C, how to initialize C string.\",\"breadcrumb\":{\"@id\":\"https:\/\/prepbytes.com\/blog\/what-is-string-in-c\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/prepbytes.com\/blog\/what-is-string-in-c\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/prepbytes.com\/blog\/what-is-string-in-c\/#primaryimage\",\"url\":\"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1673871044889-string%20in%20c.jpg\",\"contentUrl\":\"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1673871044889-string%20in%20c.jpg\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/prepbytes.com\/blog\/what-is-string-in-c\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"http:\/\/43.205.93.38\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"C Programming\",\"item\":\"https:\/\/prepbytes.com\/blog\/category\/c-programming\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"What is String in C?\"}]},{\"@type\":\"WebSite\",\"@id\":\"http:\/\/43.205.93.38\/#website\",\"url\":\"http:\/\/43.205.93.38\/\",\"name\":\"PrepBytes Blog\",\"description\":\"ONE-STOP RESOURCE FOR EVERYTHING RELATED TO CODING\",\"publisher\":{\"@id\":\"http:\/\/43.205.93.38\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"http:\/\/43.205.93.38\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"http:\/\/43.205.93.38\/#organization\",\"name\":\"Prepbytes\",\"url\":\"http:\/\/43.205.93.38\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"http:\/\/43.205.93.38\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/blog.prepbytes.com\/wp-content\/uploads\/2025\/07\/uzxxllgloialmn9mhwfe.webp\",\"contentUrl\":\"https:\/\/blog.prepbytes.com\/wp-content\/uploads\/2025\/07\/uzxxllgloialmn9mhwfe.webp\",\"width\":160,\"height\":160,\"caption\":\"Prepbytes\"},\"image\":{\"@id\":\"http:\/\/43.205.93.38\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/prepbytes0211\/\",\"https:\/\/www.instagram.com\/prepbytes\/\",\"https:\/\/www.linkedin.com\/company\/prepbytes\/\",\"https:\/\/www.youtube.com\/channel\/UC0xGnHDrjUM1pDEK2Ka5imA\"]},{\"@type\":\"Person\",\"@id\":\"http:\/\/43.205.93.38\/#\/schema\/person\/3f7dc4ae851791d5947a7f99df363d5e\",\"name\":\"Prepbytes\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"http:\/\/43.205.93.38\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/232042cd1a1ea0e982c96d2a2ec93fb70a8e864e00784491231e7bfe5a9e06b5?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/232042cd1a1ea0e982c96d2a2ec93fb70a8e864e00784491231e7bfe5a9e06b5?s=96&d=mm&r=g\",\"caption\":\"Prepbytes\"},\"url\":\"https:\/\/prepbytes.com\/blog\/author\/gourav-jaincollegedekho-com\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"What is String in C?","description":"Here we will deep dive into C String. We will learn what is string in C, string definition in C, how to declare string in C, how to initialize C string.","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:\/\/prepbytes.com\/blog\/what-is-string-in-c\/","og_locale":"en_US","og_type":"article","og_title":"What is String in C?","og_description":"Here we will deep dive into C String. We will learn what is string in C, string definition in C, how to declare string in C, how to initialize C string.","og_url":"https:\/\/prepbytes.com\/blog\/what-is-string-in-c\/","og_site_name":"PrepBytes Blog","article_publisher":"https:\/\/www.facebook.com\/prepbytes0211\/","article_published_time":"2023-01-18T04:49:20+00:00","article_modified_time":"2023-06-06T13:17:05+00:00","og_image":[{"url":"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1673871044889-string%20in%20c.jpg","type":"","width":"","height":""}],"author":"Prepbytes","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Prepbytes","Est. reading time":"9 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/prepbytes.com\/blog\/what-is-string-in-c\/#article","isPartOf":{"@id":"https:\/\/prepbytes.com\/blog\/what-is-string-in-c\/"},"author":{"name":"Prepbytes","@id":"http:\/\/43.205.93.38\/#\/schema\/person\/3f7dc4ae851791d5947a7f99df363d5e"},"headline":"What is String in C?","datePublished":"2023-01-18T04:49:20+00:00","dateModified":"2023-06-06T13:17:05+00:00","mainEntityOfPage":{"@id":"https:\/\/prepbytes.com\/blog\/what-is-string-in-c\/"},"wordCount":1963,"commentCount":0,"publisher":{"@id":"http:\/\/43.205.93.38\/#organization"},"image":{"@id":"https:\/\/prepbytes.com\/blog\/what-is-string-in-c\/#primaryimage"},"thumbnailUrl":"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1673871044889-string%20in%20c.jpg","articleSection":["C Programming"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/prepbytes.com\/blog\/what-is-string-in-c\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/prepbytes.com\/blog\/what-is-string-in-c\/","url":"https:\/\/prepbytes.com\/blog\/what-is-string-in-c\/","name":"What is String in C?","isPartOf":{"@id":"http:\/\/43.205.93.38\/#website"},"primaryImageOfPage":{"@id":"https:\/\/prepbytes.com\/blog\/what-is-string-in-c\/#primaryimage"},"image":{"@id":"https:\/\/prepbytes.com\/blog\/what-is-string-in-c\/#primaryimage"},"thumbnailUrl":"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1673871044889-string%20in%20c.jpg","datePublished":"2023-01-18T04:49:20+00:00","dateModified":"2023-06-06T13:17:05+00:00","description":"Here we will deep dive into C String. We will learn what is string in C, string definition in C, how to declare string in C, how to initialize C string.","breadcrumb":{"@id":"https:\/\/prepbytes.com\/blog\/what-is-string-in-c\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/prepbytes.com\/blog\/what-is-string-in-c\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/prepbytes.com\/blog\/what-is-string-in-c\/#primaryimage","url":"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1673871044889-string%20in%20c.jpg","contentUrl":"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1673871044889-string%20in%20c.jpg"},{"@type":"BreadcrumbList","@id":"https:\/\/prepbytes.com\/blog\/what-is-string-in-c\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"http:\/\/43.205.93.38\/"},{"@type":"ListItem","position":2,"name":"C Programming","item":"https:\/\/prepbytes.com\/blog\/category\/c-programming\/"},{"@type":"ListItem","position":3,"name":"What is String in C?"}]},{"@type":"WebSite","@id":"http:\/\/43.205.93.38\/#website","url":"http:\/\/43.205.93.38\/","name":"PrepBytes Blog","description":"ONE-STOP RESOURCE FOR EVERYTHING RELATED TO CODING","publisher":{"@id":"http:\/\/43.205.93.38\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"http:\/\/43.205.93.38\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"http:\/\/43.205.93.38\/#organization","name":"Prepbytes","url":"http:\/\/43.205.93.38\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"http:\/\/43.205.93.38\/#\/schema\/logo\/image\/","url":"https:\/\/blog.prepbytes.com\/wp-content\/uploads\/2025\/07\/uzxxllgloialmn9mhwfe.webp","contentUrl":"https:\/\/blog.prepbytes.com\/wp-content\/uploads\/2025\/07\/uzxxllgloialmn9mhwfe.webp","width":160,"height":160,"caption":"Prepbytes"},"image":{"@id":"http:\/\/43.205.93.38\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/prepbytes0211\/","https:\/\/www.instagram.com\/prepbytes\/","https:\/\/www.linkedin.com\/company\/prepbytes\/","https:\/\/www.youtube.com\/channel\/UC0xGnHDrjUM1pDEK2Ka5imA"]},{"@type":"Person","@id":"http:\/\/43.205.93.38\/#\/schema\/person\/3f7dc4ae851791d5947a7f99df363d5e","name":"Prepbytes","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"http:\/\/43.205.93.38\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/232042cd1a1ea0e982c96d2a2ec93fb70a8e864e00784491231e7bfe5a9e06b5?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/232042cd1a1ea0e982c96d2a2ec93fb70a8e864e00784491231e7bfe5a9e06b5?s=96&d=mm&r=g","caption":"Prepbytes"},"url":"https:\/\/prepbytes.com\/blog\/author\/gourav-jaincollegedekho-com\/"}]}},"_links":{"self":[{"href":"https:\/\/prepbytes.com\/blog\/wp-json\/wp\/v2\/posts\/11695","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/prepbytes.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/prepbytes.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/prepbytes.com\/blog\/wp-json\/wp\/v2\/users\/52"}],"replies":[{"embeddable":true,"href":"https:\/\/prepbytes.com\/blog\/wp-json\/wp\/v2\/comments?post=11695"}],"version-history":[{"count":5,"href":"https:\/\/prepbytes.com\/blog\/wp-json\/wp\/v2\/posts\/11695\/revisions"}],"predecessor-version":[{"id":16717,"href":"https:\/\/prepbytes.com\/blog\/wp-json\/wp\/v2\/posts\/11695\/revisions\/16717"}],"wp:attachment":[{"href":"https:\/\/prepbytes.com\/blog\/wp-json\/wp\/v2\/media?parent=11695"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/prepbytes.com\/blog\/wp-json\/wp\/v2\/categories?post=11695"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/prepbytes.com\/blog\/wp-json\/wp\/v2\/tags?post=11695"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}