Posts

Showing posts from February, 2024

Tokens in C

Image
A token in C can be defined as the smallest individual element of the C programming language that is meaningful to the compiler. It is the basic component of a C program. Types of Tokens in C : The tokens of C language can be classified into six types based on the functions they are used to perform. The types of C tokens are as follows: Keywords Identifiers Constants Strings Special Symbols Operators 1. C Token – Keywords : The keywords are pre-defined or reserved words in a programming language. Each keyword is meant to perform a specific function in a program. Since keywords are referred names for a compiler, they can’t be used as variable names because by doing so, we are trying to assign a new meaning to the keyword which is not allowed. You cannot redefine keywords. However, you can specify the text to be substituted for keywords before compilation by using C preprocessor directives. C language supports 32 keywords which are given below:  auto              double           int   

State the use of printf() and scanf() with suitable example

 The printf() function is used to display output and the scanf() function is used to take input from users. The printf() and scanf() functions are commonly used functions in C Language. These functions are inbuilt library functions in header files of C programming. printf() Function: In C Programming language, the printf() function is used for output. printf() function can take any number of farguments. First argument must be enclosed within the double quotes "hello" and every other argument should be separated by comma (,) within the double quotes.  Important points about printf(): printf() function is defined in stdio.h header file. By using this function, we can  print the data or user-defined message on monitor (also called the console). printf() can print a different kind of data format on the output string. To print on a new line on the screen, we use "\n" in printf() statement. C language is case sensitive programming language. For example, printf() and scan