An array is a data structure used in programming to store a collection of elements, typically of the same type, in a fixed-size sequence. Initialisation of Array 1#include <stdio.h> 2int main() 3{ 4 // it's not important to give size during initialisation. 5 // eg: float y[]={1.2,2,3.32}; 6 7 int g[5]; 8 int …
Read MoreC is a powerful, general-purpose programming language that provides control over system resources and efficient execution. This post will cover some essential concepts in C that every programmer should understand: Control Strings, Global Variables, Strings, Switch Statements, Ternary Operators, Unformatted …
Read MoreTo find average of two numbers. 1#include <stdio.h> 2int main() 3{ 4 float a; 5 float b; 6 printf("give the values for a and b:\n"); 7 scanf("%f%f", &a,&b); 8 float c=(a+b)/2; 9 printf("the average of two numbers is %f\n", c); 10 return 0; 11} To find the binary equivalent of a …
Read MoreLoops in C language are used to repeatedly execute a block of code based on certain conditions. They are fundamental for tasks such as iterating over arrays, processing data, and performing repetitive operations. Loops 1#include <stdio.h> 2#include <string.h> 3 4void main() 5{ 6 // loop means - to execute …
Read MoreMatrices: Matrix Multiplication 1#include<stdio.h> 2int main() 3{ int m,n,p,q,a[10][10],b[10][10],c[10][10],k,i,j; 4 printf("enter the rows and column value for matrix 1:\n"); 5 scanf("%d%d",&m,&n); 6 printf("enter the rows and columns value for matrix 2:\n"); 7 …
Read MorePointers Basics 1#include<stdio.h> 2int main() 3{ 4 int a=10; 5 printf("Address of P: %p \n", *a); 6 7 int *p; 8 9 p=&a; 10 11 *p = 30; 12 13 printf("Address of P: %p \n", p); 14 printf("Value of P: %d \n", a); 15 printf("%d", *(&a)); 16 17 18} to read the elements and …
Read MoreSearching in C language refers to the process of finding a specific element or value within a data structure, typically an array. Searching algorithms help determine whether an element exists in the data structure and, if so, its position. Searching: L-Search 1#include<stdio.h> 2int lsearch(int b[],int n,int …
Read MoreSorting in C language refers to arranging the elements of an array in a specific order, typically in ascending or descending order. Sorting: Bubble Sort 1#include <stdio.h> 2int main() 3{ 4 int i, j, k, temp, n, a[20]; 5 6 printf("enter the number of elements in the array:\n"); 7 scanf("%d", …
Read MoreWhen we set our new system, while setting up an operating system on our system, we got an option to select the hard disk, do I want to divide my memory in certain section, you can divide the memory in n number of section but for my case I have divided it into two parts which is C: drive (which is the local drive) and …
Read MoreNow let's talk about different environments, so on our system, we can work on more than one O.S. if, like on my windows I have ubuntu. In case of Windows for installing a secondary O.S. there is a software known as WSL: which allows me to install a secondary O.S. on my primary operating system. Another example: Virtual …
Read More