Here, we will create a c program to detect tokens in a C program. This is called the lexical analysis phase of the compiler. The lexical analyzer is the part of the compiler that detects the token of the program and sends it to the syntax analyzer.Token is the smallest entity of the code, it is either a keyword, identifier, constant, string literal, symbol.Examples of different types of tokens in C.ExampleKeywords: for, if, include, etc Identifier: variables, functions, etc separators: ‘, ’, ‘;’, etc operators: ‘-’, ‘=’, ‘++’, etcProgram to detect tokens in a C program−Example Live Demo#include #include ... Read More
We can change the color of the axis, ticks and labels, using ax.spines['left'].set_color('red') and ax.spines['top'].set_color('red') statements. To change the color of the axis, ticks, and labels for a plot in matplotlib, we can take the following steps −Create a new figure, or activate an existing figure, using plt.figure().Add an axis to the figure as part of a subplot arrangement, using plt.add_subplot(xyz) where x is nrows, y is ncols and z is the index. Here taking x = 1(rows), y = 2(columns) and z = 1(position).Set up X-axis and Y-axis labels using set_xlabel and set_ylabel method for creating ax using add_subplot().To ... Read More
In this program, we will see how to add two 8-bit numbers using 8085 microprocessor.Problem StatementWrite 8085 Assembly language program to add two 8-bit numbers and store the result at locations 8050H and 8051H.DiscussionTo perform this task, we are using the ADD operation of 8085 Microprocessor. When the result of the addition is the 1-byte result, then the carry flag will not be enabled. When the result is exceeding the 1-byte range, then the carry flag will be 1We are using two numbers at location 8000H and 8001H. When the numbers are 6CH and 24H, then the result will be ... Read More
You can find the minimum and maximum values of an array using for loops −ExampleLive Demopublic class MinAndMax { public int max(int [] array) { int max = 0; for(int i=0; imax) { max = array[i]; } } return max; } public int min(int [] array) { int min = array[0]; for(int i=0; i
A PHP application produces many levels of errors during the runtime of the script . So in this article, we will learn how to display all the errors and warning messages. The quickest way to display all php errors and warnings is to add these lines to your PHP code file: ini_set('display_errors', 1); ini_set('display_startup_errors', 1); error_reporting(E_ALL); The ini_set function will try to override the configuration found in your php.ini file. If in the php.ini file display_error is turned off it will turn that on in the code. It also set display_startup_errors to true to show the error message. error_reporting() ... Read More
Yes, we can execute a java program without a main method by using a static block. Static block in Java is a group of statements that gets executed only once when the class is loaded into the memory by Java ClassLoader, It is also known as a static initialization block. Static initialization block is going directly into the stack memory. Example class StaticInitializationBlock{ static{ System.out.println("class without a main method"); System.exit(0); } } In the above example, we can execute a java program without a main method (works until Java 1.6 version). ... Read More
There are so many characteristics of a database management system, which are as follows − A database management system is able to store any kind of data in a database. The database management system has to support ACID (atomicity, consistency, isolation, durability) properties. The Database management system allows so many users to access databases at the same time. Backup and recovery are ... Read More
You can read a character in a String using the charAt() method. To find the vowels in a given String you need to compare every character in it with the vowel letters. Example Live Demo public class FindingVowels { public static void main(String args[]) { String str = new String("Hi Welcome to Tutorialspoint"); for(int i=0; i
Protection and security requires that computer resources such as CPU, softwares, memory etc. are protected. This extends to the operating system as well as the data in the system. This can be done by ensuring integrity, confidentiality and availability in the operating system. The system must be protect against unauthorized access, viruses, worms etc. Threats to Protection and Security A threat is a program that is malicious in nature and leads to harmful effects for the system. Some of the common threats that occur in a system are − Virus Viruses are generally small snippets of code embedded in a ... Read More
Operating systems work as an interface between the user and the computer hardware. OS is the software which performs the basic tasks like input, output, disk management, controlling peripherals etc. Windows, Linux etc are some examples of operating systems. Operating System Evolution Operating system is divided into four generations, which are explained as follows − First Generation (1945-1955) It is the beginning of the development of electronic computing systems which are substitutes for mechanical computing systems. Because of the drawbacks in mechanical computing systems like, the speed of humans to calculate is limited and humans can easily make mistakes. In ... Read More