{"id":319,"date":"2023-01-18T14:08:17","date_gmt":"2023-01-18T14:08:17","guid":{"rendered":"https:\/\/aipsacademy.com\/blogs\/?p=319"},"modified":"2023-01-18T14:08:18","modified_gmt":"2023-01-18T14:08:18","slug":"tokens-in-c-programming-language","status":"publish","type":"post","link":"https:\/\/aipsacademy.com\/blogs\/2023\/01\/18\/tokens-in-c-programming-language\/","title":{"rendered":"Tokens in C++ Programming Language"},"content":{"rendered":"\n<p>The smallest individual unit of <a href=\"https:\/\/en.wikipedia.org\/wiki\/C%2B%2B\">C++<\/a> program is called tokens.<\/p>\n\n\n\n<p>A C++ program is made up of various tokens.<\/p>\n\n\n\n<p>There are following types of tokens:<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>Keywords \/ Reserve words<\/li><li>Identifiers \/ Variables<\/li><li>Constants\/ Literals<\/li><li><a href=\"https:\/\/en.wikipedia.org\/wiki\/Operators_in_C_and_C%2B%2B\">Operators<\/a><\/li><li>Separators \/ Punctuators \/ special characters<\/li><\/ol>\n\n\n\n<h4 class=\"wp-block-heading\">1.<strong>Keywords<\/strong><\/h4>\n\n\n\n<p>  Keywords have fixed meaning and these meaning can&#8217;t be changed.<\/p>\n\n\n\n<p>Keywords are reserve words for the system, so these are also known as reserve words.<\/p>\n\n\n\n<p>These are the special words that has special importance and significance.<\/p>\n\n\n\n<p>There are <strong>63 keywords<\/strong> in C++.<\/p>\n\n\n\n<p>These can&#8217;t be used as user defined name like variable name, array name , function name, class name , etc&#8230;<\/p>\n\n\n\n<p class=\"has-cyan-bluish-gray-background-color has-background\">Example :   char, int , float, long, double, void , if , else, break, switch, for, while , do, class, struct, union , <\/p>\n\n\n\n<h4 class=\"wp-block-heading\">2. <strong>Identifier<\/strong><\/h4>\n\n\n\n<p>  Meaningful variable name, array name, function name, class name, etc.. known as Identifier.<\/p>\n\n\n\n<p>An identifier is a user defined word.<\/p>\n\n\n\n<p><strong>Variable:<\/strong>&#8211;  it is a data name used to store data value.<\/p>\n\n\n\n<p>it is like a container of data.<\/p>\n\n\n\n<p><strong>Rules for declaring variable<\/strong>:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>The variable name must begin with character without space but underscore is permitted.<\/li><li>The variable name should not start with a digit.<\/li><li>The variable name should not be a  C++ keywords.<\/li><li>The variable name may be a combination of uppercase and lowercase character.<\/li><li>The length of variable may up to 31 characters.<\/li><li>Special characters or symbols not allowed between variable name.<\/li><\/ul>\n\n\n\n<p> 3<strong>.Constant<\/strong> :-  It refers to fixed value and the value can&#8217;t be changed during the program execution. <\/p>\n\n\n\n<p>we use <strong>const<\/strong> keyword or <strong>#define<\/strong> for declaring constant.<\/p>\n\n\n\n<p>Example<\/p>\n\n\n\n<p>const float pi=3.14;<\/p>\n\n\n\n<p>#define pi 3.14<\/p>\n\n\n\n<p>There are two types of constants.<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>Numeric constant<ul><li>a. Integer constant      ex..  5,  -17,<\/li><li>b. Real constant          ex..   12.6 ,  -18.5<\/li><\/ul><\/li><li>Character constant<ul><li>a.  Single character    ex..  &#8216;5&#8217;  &#8216;\u00c1&#8217;  <\/li><li>b.  String constant      ex.  &#8220;528&#8221;     &#8220;Ram&#8221;<\/li><\/ul><\/li><\/ol>\n\n\n\n<h4 class=\"wp-block-heading\">4. <strong>Operator<\/strong><\/h4>\n\n\n\n<p>  An operator is a symbol that represent operation between operands.<\/p>\n\n\n\n<p>An operator is a symbol that perform operations(such as addition, subtraction,multiplication,division etc) on various data items(operands) to  produce result.<\/p>\n\n\n\n<p>C=a+b<\/p>\n\n\n\n<p>Here a,b,c are operands, and  +  and =  are operators<\/p>\n\n\n\n<p>5. <strong>Separators<\/strong> :- These define structure of a program.<\/p>\n\n\n\n<p>example     {} ,[],(), etc<\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe loading=\"lazy\" title=\"12th #JAC  #Computer Science #objective 2022  tak | Five years Previous Year Computer Science\" width=\"810\" height=\"456\" src=\"https:\/\/www.youtube.com\/embed\/IVpDT322GfI?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" allowfullscreen><\/iframe>\n<\/div><\/figure>\n\n\n\n<p><a href=\"http:\/\/www.nipsacademy.com\/blogs\/translators-in-programming-languages\/\">Also Read : &#8211; Translators in C++ Language<\/a><\/p>\n\n\n\n<p><a href=\"http:\/\/www.nipsacademy.com\/blogs\/computer-science-xii-2020\/\">Also Read :- Previous year Question <\/a> &amp;<a href=\"http:\/\/www.nipsacademy.com\/blogs\/computer-science-xii-2020\/\"> important program<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The smallest individual unit of C++ program is called tokens. A C++ program is made up of various tokens. There are following types of tokens: Keywords \/ Reserve words Identifiers \/ Variables Constants\/ Literals Operators Separators \/ Punctuators \/ special characters 1.Keywords Keywords have fixed meaning and these meaning can&#8217;t be changed. Keywords are reserve [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":320,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,5,3,9,7,8,6],"tags":[],"class_list":["post-319","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-11th-computer-science","category-12th-computer-science","category-bca","category-cbse-12th-computer-science","category-cbse","category-jac-12th-computer-science","category-jac"],"_links":{"self":[{"href":"https:\/\/aipsacademy.com\/blogs\/wp-json\/wp\/v2\/posts\/319","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/aipsacademy.com\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/aipsacademy.com\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/aipsacademy.com\/blogs\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/aipsacademy.com\/blogs\/wp-json\/wp\/v2\/comments?post=319"}],"version-history":[{"count":1,"href":"https:\/\/aipsacademy.com\/blogs\/wp-json\/wp\/v2\/posts\/319\/revisions"}],"predecessor-version":[{"id":321,"href":"https:\/\/aipsacademy.com\/blogs\/wp-json\/wp\/v2\/posts\/319\/revisions\/321"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/aipsacademy.com\/blogs\/wp-json\/wp\/v2\/media\/320"}],"wp:attachment":[{"href":"https:\/\/aipsacademy.com\/blogs\/wp-json\/wp\/v2\/media?parent=319"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/aipsacademy.com\/blogs\/wp-json\/wp\/v2\/categories?post=319"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/aipsacademy.com\/blogs\/wp-json\/wp\/v2\/tags?post=319"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}