Skip to main content

Computer Programming - Keywords

Computer Programming - Keywords


Advertisements


So far, we have covered two important concepts called variables and their data types. We discussed how to use intlong, and float to specify different data types. We also learnt how to name the variables to store different values.
Though this chapter is not required separately because reserved keywords are a part of basic programming syntax, we kept it separate to explain it right after data types and variables to make it easy to understand.
Like int, long, and float, there are many other keywords supported by C programming language which we will use for different purpose. Different programming languages provide different set of reserved keywords, but there is one important & common rule in all the programming languages that we cannot use a reserved keyword to name our variables, which means we cannot name our variable like int or float rather these keywords can only be used to specify a variable data type.
For example, if you will try to use any reserved keyword for the purpose of variable name, then you will get a syntax error.
#include <stdio.h>

main() {

   int float;
   
   float = 10;
   
   printf( "Value of float = %d\n", float);
}
When you compile the above program, it produces the following error −
main.c: In function 'main':
main.c:5:8: error: two or more data types in declaration specifiers
    int float;
......
Let's now give a proper name to our integer variable, then the above program should compile and execute successfully −
#include <stdio.h>

main() {
   int count;

   count = 10;

   printf( "Value of count = %d\n", count);
}

C Programming Reserved Keywords

Here is a table having almost all the keywords supported by C Programming language −
autoelselongswitch
breakenumregistertypedef
caseexternreturnunion
charfloatshortunsigned
constforsignedvoid
continuegotosizeofvolatile
defaultifstaticwhile
dointstruct_Packed
double   

Java Programming Reserved Keywords

Here is a table having almost all the keywords supported by Java Programming language −
abstractassertbooleanbreak
bytecasecatchchar
classconstcontinuedefault
dodoubleelseenum
extendsfinalfinallyfloat
forgotoifimplements
importinstanceofintinterface
longnativenewpackage
privateprotectedpublicreturn
shortstaticstrictfpsuper
switchsynchronizedthisthrow
throwstransienttryvoid
volatilewhile  

Python Programming Reserved Keywords

Here is a table having almost all the keywords supported by Python Programming language −
andexecnot
assertfinallyor
breakforpass
classfromprint
continueglobalraise
defifreturn
delimporttry
elifinwhile
elseiswith
exceptlambdayield
We know you cannot memorize all these keywords, but we have listed them down for your reference purpose and to explain the concept of reserved keywords. So just be careful while giving a name to your variable, you should not use any reserved keyword for that programming language.

Comments

Popular posts from this blog

Education of India Part 2

History [ edit ] Main article:  History of education in South Asia The remnants of the library of  Nalanda , built in the 5th century BCE by  Gupta kings . It was rebuilt twice after invasion, first after an invasion from the  Huns  in the 5th century BCE and then after an invasion from the  Gaudas  in the 7th century CE but abandoned after the third invasion by  Turkic invaders  in the 12th century. Takshasila  (in modern-day Pakistan) was the earliest recorded centre of higher learning in India from possibly 8th century BCE, and it is debatable whether it could be regarded a university or not in modern sense, since teachers living there may not have had official membership of particular colleges, and there did not seem to have existed purpose-built lecture halls and residential quarters in Taxila, in contrast to the later Nalanda university in eastern India.  Nalanda  was the oldest university-system of education in the world in the modern sense of university. There al

Save a Workbook in another File Format

  Save a Workbook in another File Format When you save an Excel 2013 Workbook, by default it saves in the  .xlsx  format. Excel 2013 supports saving in other formats, but whenever you save a workbook in another file format, some of its formatting, data, and features might not be saved. File Formats (File Types) that are supported in Excel 2013 − Excel File Formats Text File Formats Other File Formats Excel File Formats Format Extension Description Excel Workbook .xlsx The default XML-based file format for Excel 2007-2013. Cannot store Microsoft Visual Basic for Applications (VBA) macro code or Microsoft Office Excel 4.0 macro sheets (.xlm). Strict Open XML Spreadsheet .xlsx An ISO strict version of the Excel Workbook file format (.xlsx). Excel Workbook (code) .xlsm The XML-based and macro-enabled file format for Excel 2007-2013. Stores VBA macro code or Excel 4.0 macro sheets (.xlm) Excel Binary Workbook .xlsb The binary file format (BIFF12) for Excel 2007-2013. Template .xltx The defa

ORGANIZATIONAL STRUCTURE OF A DEPARTMENT IN THE GOVERNMENT OF INDIA

  ORGANI