{"id":18,"date":"2019-04-05T15:43:52","date_gmt":"2019-04-05T15:43:52","guid":{"rendered":"https:\/\/www.kindsonthegenius.com\/cplusplus\/?p=18"},"modified":"2020-08-06T09:51:44","modified_gmt":"2020-08-06T09:51:44","slug":"02-c-basic-syntax","status":"publish","type":"post","link":"https:\/\/kindsonthegenius.com\/cplusplus\/02-c-basic-syntax\/","title":{"rendered":"C++ Basic Syntax"},"content":{"rendered":"<p>In this chapter, we would learn the basic syntax of the C++ programming language.<\/p>\n<p>We would cover the following:<\/p>\n<ol>\n<li><a href=\"#t1\">Basic OOP Terms<\/a><\/li>\n<li><a href=\"#t2\">Structure of C++ Program<\/a><\/li>\n<li><a href=\"#t3\">Runing a C++ Program in Eclipse<\/a><\/li>\n<li><a href=\"#t4\">Code Blocks and Lines<\/a><\/li>\n<li><a href=\"#t5\">Identifiers in C++<\/a><\/li>\n<li><a href=\"#t6\">C++ Reserved Words<\/a><\/li>\n<li><a href=\"#t7\">Trigraphs<\/a><\/li>\n<li><a href=\"#t8\">Whitespe Characters in C++<\/a><\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<h4><strong id=\"t1\">1. Basic OOP Terms<\/strong><\/h4>\n<p>OOP means Object Oriented Programming. Some OOP terms are given below:<\/p>\n<p>Let\u2019s reviews some of the important OOP terms.<\/p>\n<p><strong>Class<\/strong> \u2013 A template for creating new objects. A class specifies the attributes and behaviors of an object.<\/p>\n<p><strong>Class Variable<\/strong> \u2013 This is a variable that is shared by all objects that are created from the class. They are reference using the name of the class<\/p>\n<p><strong>Data Member<\/strong> \u2013 Variables defined in the class. They are used to hold data associated with the class<\/p>\n<p><strong>Instance Variable<\/strong> \u2013 These is a variable that is defined in a class but belongs only to the particular object of the class.<\/p>\n<p><strong>Instance<\/strong>\u00a0\u2013 An object created from a class<\/p>\n<p><strong>Instantiation<\/strong> \u2013 The process of creating an instance from a class<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<h4><strong id=\"t2\">2. Structure of C++ Program<\/strong><\/h4>\n<p>Let&#8217;s write a simple Hello World program and then try to understand it. This is given below:<\/p>\n<p>&nbsp;<\/p>\n<p><!-- HTML generated using hilite.me --><\/p>\n<pre style=\"margin: 0; line-height: 125%;\"><span style=\"color: #557799;\">#include &lt;iostream&gt;<\/span>\r\n<span style=\"color: #008800; font-weight: bold;\">using<\/span> <span style=\"color: #008800; font-weight: bold;\">namespace<\/span> std;\r\n\r\n<span style=\"color: #888888;\">\/\/Program execution begins here<\/span>\r\n<span style=\"color: #333399; font-weight: bold;\">int<\/span> <span style=\"color: #0066bb; font-weight: bold;\">main<\/span>() {\r\n   cout <span style=\"color: #333333;\">&lt;&lt;<\/span> <span style=\"background-color: #fff0f0;\">\"Welcome to C++\"<\/span>; <span style=\"color: #888888;\">\/\/ displays Welcome to C++<\/span>\r\n   <span style=\"color: #008800; font-weight: bold;\">return<\/span> <span style=\"color: #0000dd; font-weight: bold;\">0<\/span>;\r\n}\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p>Let&#8217;s now see what the various componets are:<\/p>\n<p>The first line<em><strong> #include &lt;iostream&gt;<\/strong><\/em> is known as preprocessor directive. It indicates that the file iostream is needed to compile this file<\/p>\n<p>The second line <em><strong>using namespace std<\/strong><\/em> tell the compiler to use the namespace std. For now, think of a namespace as a collection of useful objects.<\/p>\n<p>The line that begins in \/\/ is a comment. It is ignored by the compiler<\/p>\n<p>The line <em><strong>int main()<\/strong><\/em> defines a function main. This is where the program execution actually starts<\/p>\n<p><em><strong>cout &lt;&lt;&#8220;Welcome to C++&#8221;,<\/strong><\/em> print the text to the screen<\/p>\n<p>The line<em><strong> return 0<\/strong><\/em> terminates teh main function<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<h4><strong id=\"t3\">3. Runing a C++ Program in Eclipse<\/strong><\/h4>\n<p>If you have correctly installled Eclipse and Set up the MinGW compiler as outlined in <a href=\"https:\/\/kindsonthegenius.com\/cplusplus\/c-installation-and-setup\/\">Lesson 2,<\/a> then open Eclipse, click on file and choose C++ project.<\/p>\n<p>I recommend you watch the video to get clarification.<\/p>\n<p><iframe loading=\"lazy\" src=\"https:\/\/www.youtube.com\/embed\/t45bfb5nLlU\" width=\"100%\" height=\"315\" frameborder=\"0\" allowfullscreen=\"allowfullscreen\"><span data-mce-type=\"bookmark\" style=\"display: inline-block; width: 0px; overflow: hidden; line-height: 0;\" class=\"mce_SELRES_start\">\ufeff<\/span><\/iframe><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<h4><strong id=\"t4\">4. Code Blocks and Lines<\/strong><\/h4>\n<p>Notice that statements in C++ are terminated by a semicolon (;). It indicates the end of the line. For example:<\/p>\n<pre style=\"margin: 0; line-height: 125%;\">a <span style=\"color: #333333;\">=<\/span> <span style=\"color: #0000dd; font-weight: bold;\">10<\/span>;\r\nb <span style=\"color: #333333;\">=<\/span> b <span style=\"color: #333333;\">+<\/span> <span style=\"color: #0000dd; font-weight: bold;\">1<\/span>;\r\nsum(a, b);\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p>Also, a block of statements are enclosed in curly braces. For example:<\/p>\n<p><!-- HTML generated using hilite.me --><\/p>\n<pre style=\"margin: 0; line-height: 125%;\"><span style=\"color: #333399; font-weight: bold;\">int<\/span> <span style=\"color: #0066bb; font-weight: bold;\">main<\/span>() {\r\n   cout <span style=\"color: #333333;\">&lt;&lt;<\/span> <span style=\"background-color: #fff0f0;\">\"Welcome to C++\"<\/span>; <span style=\"color: #888888;\">\/\/ displays Welcome to C++<\/span>\r\n   <span style=\"color: #008800; font-weight: bold;\">return<\/span> <span style=\"color: #0000dd; font-weight: bold;\">0<\/span>;\r\n}\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<h4><strong id=\"t5\">5. Identifiers in C++<\/strong><\/h4>\n<p>As a programmer, you have the power to choose names of identifiers. Identifies are simply names given to variables.<\/p>\n<p>However, there are some rule to follow when choosing names of identifiers.<\/p>\n<ul>\n<li>Identifier names must start with letters A to Z or a to z or an underscore(_)<\/li>\n<li>Special characters like %, !, * and others cannot be used in identifier names<\/li>\n<li>Identifiers can contain numbers (but not as the first character)<\/li>\n<li>Names in C++ are case-sensitive<\/li>\n<\/ul>\n<p>Examples to valid identifiers are: eze, book1, _score, one2four, x, z, a1<\/p>\n<p>Examples of invalid identifiers are: 45house, love.me,\u00a0 pass@word, 1996<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<h4><strong id=\"t6\">6. C++ Reserved Words<\/strong><\/h4>\n<p>Reserved words are also known as keywords. They are words reserved for use by the language. Therefore you can&#8217;t choose them as identifiers. They are listed below:<\/p>\n<table class=\"table table-bordered\" width=\"100%\" align=\"center\">\n<tbody>\n<tr>\n<td>asm<\/td>\n<td>else<\/td>\n<td>new<\/td>\n<td>this<\/td>\n<\/tr>\n<tr>\n<td>auto<\/td>\n<td>enum<\/td>\n<td>operator<\/td>\n<td>throw<\/td>\n<\/tr>\n<tr>\n<td>bool<\/td>\n<td>explicit<\/td>\n<td>private<\/td>\n<td>true<\/td>\n<\/tr>\n<tr>\n<td>break<\/td>\n<td>export<\/td>\n<td>protected<\/td>\n<td>try<\/td>\n<\/tr>\n<tr>\n<td>case<\/td>\n<td>extern<\/td>\n<td>public<\/td>\n<td>typedef<\/td>\n<\/tr>\n<tr>\n<td>catch<\/td>\n<td>false<\/td>\n<td>register<\/td>\n<td>typeid<\/td>\n<\/tr>\n<tr>\n<td>char<\/td>\n<td>float<\/td>\n<td>reinterpret_cast<\/td>\n<td>typename<\/td>\n<\/tr>\n<tr>\n<td>class<\/td>\n<td>for<\/td>\n<td>return<\/td>\n<td>union<\/td>\n<\/tr>\n<tr>\n<td>const<\/td>\n<td>friend<\/td>\n<td>short<\/td>\n<td>unsigned<\/td>\n<\/tr>\n<tr>\n<td>const_cast<\/td>\n<td>goto<\/td>\n<td>signed<\/td>\n<td>using<\/td>\n<\/tr>\n<tr>\n<td>continue<\/td>\n<td>if<\/td>\n<td>sizeof<\/td>\n<td>virtual<\/td>\n<\/tr>\n<tr>\n<td>default<\/td>\n<td>inline<\/td>\n<td>static<\/td>\n<td>void<\/td>\n<\/tr>\n<tr>\n<td>delete<\/td>\n<td>int<\/td>\n<td>static_cast<\/td>\n<td>volatile<\/td>\n<\/tr>\n<tr>\n<td>do<\/td>\n<td>long<\/td>\n<td>struct<\/td>\n<td>wchar_t<\/td>\n<\/tr>\n<tr>\n<td>double<\/td>\n<td>mutable<\/td>\n<td>switch<\/td>\n<td>while<\/td>\n<\/tr>\n<tr>\n<td>dynamic_cast<\/td>\n<td>namespace<\/td>\n<td>template<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<h4><strong id=\"t7\">7. Trigraphs<\/strong><\/h4>\n<p>Though you may not use trigraphs often, it is a concept you should know. It is also called a trigraph sequence.<\/p>\n<p>It is made up of three characters. These three characters represents a single character equivalent. It always begins with as question mark.<\/p>\n<p>If you include a trigraph in a string, then when the program executes, it is replaced by the single-character equivalent.<\/p>\n<p>Some trigraphs are given below:<\/p>\n<table class=\"table table-bordered\" width=\"100%\" align=\"center\">\n<tbody>\n<tr>\n<th>Trigraph<\/th>\n<th>Single-character equivalent<\/th>\n<\/tr>\n<tr>\n<td>??=<\/td>\n<td>#<\/td>\n<\/tr>\n<tr>\n<td>??\/<\/td>\n<td>\\<\/td>\n<\/tr>\n<tr>\n<td>??&#8217;<\/td>\n<td>^<\/td>\n<\/tr>\n<tr>\n<td>??(<\/td>\n<td>[<\/td>\n<\/tr>\n<tr>\n<td>??)<\/td>\n<td>]<\/td>\n<\/tr>\n<tr>\n<td>??!<\/td>\n<td>|<\/td>\n<\/tr>\n<tr>\n<td>??&lt;<\/td>\n<td>{<\/td>\n<\/tr>\n<tr>\n<td>??&gt;<\/td>\n<td>}<\/td>\n<\/tr>\n<tr>\n<td>??-<\/td>\n<td>~<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>However, trigraphs are not supported by all compilers. So it is not generally used by programmers.<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<h4><strong id=\"t8\">8. Whitespace Characters in C+++<\/strong><\/h4>\n<p>Whitespaces are ignored by the C++ compiler. This could also be a blank line, newline and tab.<\/p>\n<p>However, you should use whitespaces to seperate parts of your code. This makes your code more-readable.<\/p>\n<p>Let&#8217;s take an example<\/p>\n<p>&nbsp;<\/p>\n<p>Code written without whitespaces<\/p>\n<p><!-- HTML generated using hilite.me --><\/p>\n<pre style=\"margin: 0; line-height: 125%;\"><span style=\"color: #888888;\">\/\/ not very good code <\/span>\r\na <span style=\"color: #333333;\">=<\/span> <span style=\"color: #0000dd; font-weight: bold;\">10<\/span>; b <span style=\"color: #333333;\">=<\/span> b <span style=\"color: #333333;\">+<\/span> <span style=\"color: #0000dd; font-weight: bold;\">1<\/span>; sum(a, b);\r\n<span style=\"color: #008800; font-weight: bold;\">if<\/span>(a <span style=\"color: #333333;\">==<\/span> b) { c <span style=\"color: #333333;\">=<\/span> e <span style=\"color: #333333;\">+<\/span> ; }\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p>Code written with whitepaces<\/p>\n<p><!-- HTML generated using hilite.me --><\/p>\n<pre style=\"margin: 0; line-height: 125%;\"><span style=\"color: #888888;\">\/\/ not very good code <\/span>\r\na <span style=\"color: #333333;\">=<\/span> <span style=\"color: #0000dd; font-weight: bold;\">10<\/span>; \r\nb <span style=\"color: #333333;\">=<\/span> b <span style=\"color: #333333;\">+<\/span> <span style=\"color: #0000dd; font-weight: bold;\">1<\/span>; \r\nsum(a, b);\r\n\r\n<span style=\"color: #008800; font-weight: bold;\">if<\/span>(a <span style=\"color: #333333;\">==<\/span> b) {\r\n    c <span style=\"color: #333333;\">=<\/span> e <span style=\"color: #333333;\">+<\/span> ; \r\n}\r\n<\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this chapter, we would learn the basic syntax of the C++ programming language. We would cover the following: Basic OOP Terms Structure of C++ &hellip; <\/p>\n","protected":false},"author":1,"featured_media":21,"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-18","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-c-tutorials"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.9 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>C++ Basic Syntax - C++ Tutorials<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/kindsonthegenius.com\/cplusplus\/02-c-basic-syntax\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"C++ Basic Syntax - C++ Tutorials\" \/>\n<meta property=\"og:description\" content=\"In this chapter, we would learn the basic syntax of the C++ programming language. We would cover the following: Basic OOP Terms Structure of C++ &hellip;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/kindsonthegenius.com\/cplusplus\/02-c-basic-syntax\/\" \/>\n<meta property=\"og:site_name\" content=\"C++ Tutorials\" \/>\n<meta property=\"article:published_time\" content=\"2019-04-05T15:43:52+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2020-08-06T09:51:44+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/kindsonthegenius.com\/cplusplus\/wp-content\/uploads\/2019\/04\/Basic-Syntax-of-C-Program.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"845\" \/>\n\t<meta property=\"og:image:height\" content=\"424\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"kindsonthegenius\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"kindsonthegenius\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/kindsonthegenius.com\\\/cplusplus\\\/02-c-basic-syntax\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/kindsonthegenius.com\\\/cplusplus\\\/02-c-basic-syntax\\\/\"},\"author\":{\"name\":\"kindsonthegenius\",\"@id\":\"https:\\\/\\\/kindsonthegenius.com\\\/cplusplus\\\/#\\\/schema\\\/person\\\/59a11a9f72bb132f56f91ab9f8a58a0e\"},\"headline\":\"C++ Basic Syntax\",\"datePublished\":\"2019-04-05T15:43:52+00:00\",\"dateModified\":\"2020-08-06T09:51:44+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/kindsonthegenius.com\\\/cplusplus\\\/02-c-basic-syntax\\\/\"},\"wordCount\":740,\"commentCount\":0,\"image\":{\"@id\":\"https:\\\/\\\/kindsonthegenius.com\\\/cplusplus\\\/02-c-basic-syntax\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/kindsonthegenius.com\\\/cplusplus\\\/wp-content\\\/uploads\\\/2019\\\/04\\\/Basic-Syntax-of-C-Program.jpg\",\"articleSection\":[\"C++ Tutorials\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/kindsonthegenius.com\\\/cplusplus\\\/02-c-basic-syntax\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/kindsonthegenius.com\\\/cplusplus\\\/02-c-basic-syntax\\\/\",\"url\":\"https:\\\/\\\/kindsonthegenius.com\\\/cplusplus\\\/02-c-basic-syntax\\\/\",\"name\":\"C++ Basic Syntax - C++ Tutorials\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/kindsonthegenius.com\\\/cplusplus\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/kindsonthegenius.com\\\/cplusplus\\\/02-c-basic-syntax\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/kindsonthegenius.com\\\/cplusplus\\\/02-c-basic-syntax\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/kindsonthegenius.com\\\/cplusplus\\\/wp-content\\\/uploads\\\/2019\\\/04\\\/Basic-Syntax-of-C-Program.jpg\",\"datePublished\":\"2019-04-05T15:43:52+00:00\",\"dateModified\":\"2020-08-06T09:51:44+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/kindsonthegenius.com\\\/cplusplus\\\/#\\\/schema\\\/person\\\/59a11a9f72bb132f56f91ab9f8a58a0e\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/kindsonthegenius.com\\\/cplusplus\\\/02-c-basic-syntax\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/kindsonthegenius.com\\\/cplusplus\\\/02-c-basic-syntax\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/kindsonthegenius.com\\\/cplusplus\\\/02-c-basic-syntax\\\/#primaryimage\",\"url\":\"https:\\\/\\\/kindsonthegenius.com\\\/cplusplus\\\/wp-content\\\/uploads\\\/2019\\\/04\\\/Basic-Syntax-of-C-Program.jpg\",\"contentUrl\":\"https:\\\/\\\/kindsonthegenius.com\\\/cplusplus\\\/wp-content\\\/uploads\\\/2019\\\/04\\\/Basic-Syntax-of-C-Program.jpg\",\"width\":845,\"height\":424,\"caption\":\"Basic Syntax of C++ Program\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/kindsonthegenius.com\\\/cplusplus\\\/02-c-basic-syntax\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/kindsonthegenius.com\\\/cplusplus\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"C++ Basic Syntax\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/kindsonthegenius.com\\\/cplusplus\\\/#website\",\"url\":\"https:\\\/\\\/kindsonthegenius.com\\\/cplusplus\\\/\",\"name\":\"C++ Tutorials\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/kindsonthegenius.com\\\/cplusplus\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/kindsonthegenius.com\\\/cplusplus\\\/#\\\/schema\\\/person\\\/59a11a9f72bb132f56f91ab9f8a58a0e\",\"name\":\"kindsonthegenius\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/b9d710de456c3d85e5614c3a6992fa3d527425e2ab32b8bd5d85bfbaa235004b?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/b9d710de456c3d85e5614c3a6992fa3d527425e2ab32b8bd5d85bfbaa235004b?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/b9d710de456c3d85e5614c3a6992fa3d527425e2ab32b8bd5d85bfbaa235004b?s=96&d=mm&r=g\",\"caption\":\"kindsonthegenius\"},\"url\":\"https:\\\/\\\/kindsonthegenius.com\\\/cplusplus\\\/author\\\/kindsonthegenius-3\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"C++ Basic Syntax - C++ Tutorials","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:\/\/kindsonthegenius.com\/cplusplus\/02-c-basic-syntax\/","og_locale":"en_US","og_type":"article","og_title":"C++ Basic Syntax - C++ Tutorials","og_description":"In this chapter, we would learn the basic syntax of the C++ programming language. We would cover the following: Basic OOP Terms Structure of C++ &hellip;","og_url":"https:\/\/kindsonthegenius.com\/cplusplus\/02-c-basic-syntax\/","og_site_name":"C++ Tutorials","article_published_time":"2019-04-05T15:43:52+00:00","article_modified_time":"2020-08-06T09:51:44+00:00","og_image":[{"width":845,"height":424,"url":"https:\/\/kindsonthegenius.com\/cplusplus\/wp-content\/uploads\/2019\/04\/Basic-Syntax-of-C-Program.jpg","type":"image\/jpeg"}],"author":"kindsonthegenius","twitter_card":"summary_large_image","twitter_misc":{"Written by":"kindsonthegenius","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/kindsonthegenius.com\/cplusplus\/02-c-basic-syntax\/#article","isPartOf":{"@id":"https:\/\/kindsonthegenius.com\/cplusplus\/02-c-basic-syntax\/"},"author":{"name":"kindsonthegenius","@id":"https:\/\/kindsonthegenius.com\/cplusplus\/#\/schema\/person\/59a11a9f72bb132f56f91ab9f8a58a0e"},"headline":"C++ Basic Syntax","datePublished":"2019-04-05T15:43:52+00:00","dateModified":"2020-08-06T09:51:44+00:00","mainEntityOfPage":{"@id":"https:\/\/kindsonthegenius.com\/cplusplus\/02-c-basic-syntax\/"},"wordCount":740,"commentCount":0,"image":{"@id":"https:\/\/kindsonthegenius.com\/cplusplus\/02-c-basic-syntax\/#primaryimage"},"thumbnailUrl":"https:\/\/kindsonthegenius.com\/cplusplus\/wp-content\/uploads\/2019\/04\/Basic-Syntax-of-C-Program.jpg","articleSection":["C++ Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/kindsonthegenius.com\/cplusplus\/02-c-basic-syntax\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/kindsonthegenius.com\/cplusplus\/02-c-basic-syntax\/","url":"https:\/\/kindsonthegenius.com\/cplusplus\/02-c-basic-syntax\/","name":"C++ Basic Syntax - C++ Tutorials","isPartOf":{"@id":"https:\/\/kindsonthegenius.com\/cplusplus\/#website"},"primaryImageOfPage":{"@id":"https:\/\/kindsonthegenius.com\/cplusplus\/02-c-basic-syntax\/#primaryimage"},"image":{"@id":"https:\/\/kindsonthegenius.com\/cplusplus\/02-c-basic-syntax\/#primaryimage"},"thumbnailUrl":"https:\/\/kindsonthegenius.com\/cplusplus\/wp-content\/uploads\/2019\/04\/Basic-Syntax-of-C-Program.jpg","datePublished":"2019-04-05T15:43:52+00:00","dateModified":"2020-08-06T09:51:44+00:00","author":{"@id":"https:\/\/kindsonthegenius.com\/cplusplus\/#\/schema\/person\/59a11a9f72bb132f56f91ab9f8a58a0e"},"breadcrumb":{"@id":"https:\/\/kindsonthegenius.com\/cplusplus\/02-c-basic-syntax\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/kindsonthegenius.com\/cplusplus\/02-c-basic-syntax\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/kindsonthegenius.com\/cplusplus\/02-c-basic-syntax\/#primaryimage","url":"https:\/\/kindsonthegenius.com\/cplusplus\/wp-content\/uploads\/2019\/04\/Basic-Syntax-of-C-Program.jpg","contentUrl":"https:\/\/kindsonthegenius.com\/cplusplus\/wp-content\/uploads\/2019\/04\/Basic-Syntax-of-C-Program.jpg","width":845,"height":424,"caption":"Basic Syntax of C++ Program"},{"@type":"BreadcrumbList","@id":"https:\/\/kindsonthegenius.com\/cplusplus\/02-c-basic-syntax\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/kindsonthegenius.com\/cplusplus\/"},{"@type":"ListItem","position":2,"name":"C++ Basic Syntax"}]},{"@type":"WebSite","@id":"https:\/\/kindsonthegenius.com\/cplusplus\/#website","url":"https:\/\/kindsonthegenius.com\/cplusplus\/","name":"C++ Tutorials","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/kindsonthegenius.com\/cplusplus\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/kindsonthegenius.com\/cplusplus\/#\/schema\/person\/59a11a9f72bb132f56f91ab9f8a58a0e","name":"kindsonthegenius","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/b9d710de456c3d85e5614c3a6992fa3d527425e2ab32b8bd5d85bfbaa235004b?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/b9d710de456c3d85e5614c3a6992fa3d527425e2ab32b8bd5d85bfbaa235004b?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/b9d710de456c3d85e5614c3a6992fa3d527425e2ab32b8bd5d85bfbaa235004b?s=96&d=mm&r=g","caption":"kindsonthegenius"},"url":"https:\/\/kindsonthegenius.com\/cplusplus\/author\/kindsonthegenius-3\/"}]}},"_links":{"self":[{"href":"https:\/\/kindsonthegenius.com\/cplusplus\/wp-json\/wp\/v2\/posts\/18","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kindsonthegenius.com\/cplusplus\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kindsonthegenius.com\/cplusplus\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kindsonthegenius.com\/cplusplus\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kindsonthegenius.com\/cplusplus\/wp-json\/wp\/v2\/comments?post=18"}],"version-history":[{"count":4,"href":"https:\/\/kindsonthegenius.com\/cplusplus\/wp-json\/wp\/v2\/posts\/18\/revisions"}],"predecessor-version":[{"id":46,"href":"https:\/\/kindsonthegenius.com\/cplusplus\/wp-json\/wp\/v2\/posts\/18\/revisions\/46"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/kindsonthegenius.com\/cplusplus\/wp-json\/wp\/v2\/media\/21"}],"wp:attachment":[{"href":"https:\/\/kindsonthegenius.com\/cplusplus\/wp-json\/wp\/v2\/media?parent=18"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kindsonthegenius.com\/cplusplus\/wp-json\/wp\/v2\/categories?post=18"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kindsonthegenius.com\/cplusplus\/wp-json\/wp\/v2\/tags?post=18"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}