Posts

Showing posts from February, 2020

C Tokens, Keywords, Identifiers, Constants, Variables, Data Types

Image
C Tokens, Keywords, Identifiers, Constants, Variables, Data Types In this tutorial, you will learn What is a Character set? Token Keywords and Identifiers What is a Variable? Integer data type Floating point data type Constants What is a Character set? Like every other language 'C' also has its own character set. A program is a set of instructions that when executed, generate an output. The data that is processed by a program consists of various characters and symbols. The output generated is also a combination of characters and symbols. A character set in 'C' is divided into, Letters Numbers Special characters White spaces (blank spaces) A compiler always ignores the use ofcharacters, but it is widely used for formatting the data. Following is the character set in 'C' programming: Letters Uppercase characters (A-Z) Lowercase characters (a-z) Numbers All the digits from 0 to 9 White spaces Blank sp

How to write Comments in C Programming

Image
How to write Comments in C Programming What Is Comment In C Language? A comment is an explanation or description of the source code of the program. It helps a developer explain logic of the code and improves program readability. At run-time, a comment is ignored by the compiler. There are two types of comments in C: 1) A comment that starts with a slash asterisk /* and finishes with an asterisk slash */ and you can place it anywhere in your code, on the same line or several lines. 2) Single-line Comments which uses a double slash // dedicated to comment single lines Example Single Line Comment // single line comment example Here is an example of comments type // C program to demo // Single Line comment #include <stdio.h> int main(void) { // This is a single line comment printf("Guru99"); return 0; // return zero } Example Multi Line Comment /* Sample Multiline Comment Line 1 Line 2 …. … */ Example Multi Line Comment #

First C Program

Image
Your First C Program Here, is a Hello World program in C #include<stdio.h> //Pre-processor directive void main() //main function declaration { printf("Hello World"); //to output the string on a display getch (); //terminating function } Here is the code explanation: Pre-processor directive #include is a pre-processor directive in 'C.' #include <stdio.h> , stdio is the library where the function printf is defined . printf is used for generating output. Before using this function, we have to first include the required file, also known as a header file (.h). You can also create your own functions, group them in header files and declare them at the top of the program to use them. To include a file in a program, use pre-processor directive #include <file-name>.h File-name is the name of a file in which the functions are stored. Pre-processor directives are always placed at the beginning of the program. The main function The