How to draw different shapes in C programming?

Using Graphics, we can draw geometric figures like circles, lines, ellipses, bars, etc. In this, we set the coordinates like leftt,top, right,bottomm.Graphics.h library is used for graphics (initgraph method).   C program to draw shapes using graphics #include<graphics.h> #include<conio.h> main() { int gdd = DETECT,gmm,leftt=100,topp=100,rightt=200,bottomm=200,xx= 300,yy=150,radiuss=50; initgraph(&gdd, &gmm, “C:\\TC\\BGI”);//initialization of graphics rectangle(leftt, topp, rightt, bottomm); circle(xx, yy, … Read more

WHAT IS THE STRUCTURE OF THE C PROGRAM?

The structure of a C program is typically organized into several parts. Here’s an outline of the key components of a basic C program: 1.Preprocessor Directives These are instructions to the C preprocessor. They usually include library imports or macro definitions and start with #. Common examples: #include <stdio.h>  // For input/output functions #include <stdlib.h> … Read more

Pointer to Array in C

Pointer to Array in C The array is also called a constant pointer. This pointer points to the first element of the array. Whenever you create an array, this pointer is automatically created. So, if you assign an array name to a pointer variable, then there is no need to use the address of the … Read more

Functions in C

Functions in C

 Function in C is a self-contained block of code that performs a specific task. Functions are used to break down a program into smaller, manageable pieces(chunks), making the code more modular(small parts), reusable(code reusable), and easier to understand and maintain. C functions have the following components: Function Declaration: It specifies the function’s name, return type, … Read more

Operators in C

Operators in C

Operators in C The symbols that are used to perform Arithmetic (mathematical), logical, and relational operations in the C language are called C operators. Types of Operators and Examples. Operator consists of the following types: Arithmetic Operators in C: The addition is denoted by a + sign. We use addition to add two variables.Subtraction is … Read more

VARIABLES AND CONSTANTS IN C

Variables and Constants in C

VARIABLES AND CONSTANTS IN C A variable is a name given to a memory location that stores data. The value of a variable can change during program execution. A constant is a value that cannot be changed during program execution. In the C programming language, a constant is an identifier that contains a specific value. … Read more

C Data Types

C Data Types

In C programming, data types specify an extensive system used for declaring variables(like int a) or functions(void fun1()) of different types. The C data type of a variable determines how much space it occupies in memory and how the bit pattern stored in memory will be understood by the processor.Various arithmetic datatypes and functional data types available in … Read more

Storage Classes in C

Storage Classes in C

Storage Classes in C Storage classes in the C Programming Language are classified into four main types according to the storage area and their behavior. In this C programming tutorial, we use these storage classes in many programs:- Automatic storage class: Automatic storage class variables in the C Programming Language will be created and destroyed … Read more

String Constants vs Char Arrays in C

String Constants vs Char Arrays in C

A string constant is a series of characters(an array of characters or a group of characters) enclosed with double quotes(like “GOOD “). A string constant is a one-dimensional (str11[]) array of characters. A character constant is a character enclosed in single quotes. (like ‘G ‘). Each character in a string takes only 1 byte. String … Read more