Posts

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

How to Download & Install GCC Compiler for C in Windows

Image
How to Download & Install GCC Compiler for C in Windows In this tutorial, we will learn to install C in Windows, Mac, and Linux. Install C on Windows We will use an open-source Integrated Development environment named Code::Blocks which bundles a compiler (named gcc offered by Free Software Foundation GNU), editor and debugger in a neat package. Step 1) Go to http://www.codeblocks.org/downloads and click Binary Release. Step 2) Choose the installer with GCC Compiler, e.g., codeblocks-17.12mingw-setup.exe which includes MinGW's GNU GCC compiler and GNU GDB debugger with Code::Blocks source files. Step 3) Run the downloaded installer and accept the default options. Step 4) Accept the Agreement Step 5) Keep the component selection default and click Next. Step 6) You may change the installation folder and click Next. Step 7) To launch Code::Blocks double click on the icon. Step 8) It will detect the gcc compiler automatically, se

What is C Programming Language?

Image
What is C Programming Language? Basics, Introduction and History What is C programming? C is a general-purpose programming language that is extremely popular, simple and flexible. It is machine-independent, structured programming language which is used extensively in various applications. C was the basics language to write everything from operating systems (Windows and many others) to complex programs like the Oracle database, Git, Python interpreter and more. It is said that 'C' is a god's programming language. One can say, C is a base for the programming. If you know 'C,' you can easily grasp the knowledge of the other programming languages that uses the concept of 'C' It is essential to have a background in computer memory mechanisms because it is an important aspect when dealing with the C programming language. IEEE-the best 10 top programming language in 2018

History of C language

Image
History of C language The base or father of programming languages is 'ALGOL.' It was first introduced in 1960. 'ALGOL' was used on a large basis in European countries. 'ALGOL' introduced the concept of structured programming to the developer community. In 1967, a new computer programming language was announced called as 'BCPL' which stands for Basic Combined Programming Language. BCPL was designed and developed by Martin Richards, especially for writing system software. This was the era of programming languages. Just after three years, in 1970 a new programming language called 'B' was introduced by Ken Thompson that contained multiple features of 'BCPL.' This programming language was created using UNIX operating system at AT&T and Bell Laboratories. Both the 'BCPL' and 'B' were system programming languages. In 1972, a great computer scientist Dennis Ritchie created a new programming language called

Loops in C

Image
How to use Loops in C In any programming language including C, loops are used to execute a set of statements repeatedly until a particular condition is satisfied. How it Works The below diagram depicts a loop execution, As per the above diagram, if the Test Condition is true, then the loop is executed, and if it is false then the execution breaks out of the loop. After the loop is successfully executed the execution again starts from the Loop entry and again checks for the Test condition, and this keeps on repeating. The sequence of statements to be executed is kept inside the curly braces { } known as the Loop body . After every execution of the loop body, condition is verified, and if it is found to be true the loop body is executed again. When the condition check returns false , the loop body is not executed, and execution breaks out of the loop. Types of Loop There are 3 types of Loop in C language, namely: while loop for loop do while loop while