Posts

Showing posts from June, 2022

#6 | Pointers | Write a Program to store n Elements in an array and print them using Pointers

Image
  YouTube Video :-  Question :-  Write a Program to store n elements in an array and print the elements using pointers Code :- // 6. Write a program to store n elements in an array and print the //elements using pointer. #include <stdio.h> void main() {     // declare array and pointer variable     int a[ 5 ],i;     int *p;     // collect values from user and store them in an array     for (i = 0 ; i < 5 ; i++)     {         printf( "\n Enter Number :- " );         scanf( "%d" ,&a[i]);     }     // assign the address of array's first number     p = &a[ 0 ];     // print values of array     printf( "\n\nPrinting Values of array a\n" );     for (i = 0 ; i < 5 ; i++)     {         printf( "\n a[%d] = %d" ,i,*p);         p++;     } } Description :- In This Program our query is to store n Elements is an array using pointers and also print them. In Previous Practical Videos we learn that how to store memory address of a

#5 | Pointers | Find Maximum Number Using Pointers | #comptech #prathamrathod

Image
   YouTube Video :-  Question :-  Write a Program to Find a Maximum Number using Pointer's Code :- #include <stdio.h> void main() {     // declaring Variables     int a,b;     int *p,*p1;     // Initilize Values     printf( "Enter First Number : " );     scanf( "%d" ,&a);     printf( "\nEnter Second Number : " );     scanf( "%d" ,&b);     // assign address of two varriables to the pointer variable     p = &a;     p1 = &b;     if (*p > *p1)     {         printf( "%d is Maximum " ,*p);     }     else     {         printf( "%d is Maximum " ,*p1);     } } Description :- In this Program , we have to find a maximum number from two numbers using pointers. First we will declare two integer variables for storing the values. Then we will declare two pointers variable, so that we can store the memory addresses of two variables (Because in our query we have find maximum number using pointer's) For comp

#4 | Pointers | Write a program to add two numbers using pointers. | C Language

Image
  YouTube Video :-  Question :-  Write a Program to add two numbers using Pointers Code :- #include <stdio.h> void main() {     // declaring Variables     int a,b;     int *p,*p1;     // Initilize Values     printf( "Enter First Number : " );     scanf( "%d" ,&a);     printf( "\nEnter Second Number : " );     scanf( "%d" ,&b);     // assign address of two varriables to the pointer variable     p = &a;     p1 = &b;     // sum of two numbers     printf( "\nSum = %d" ,*p + *p1); } Description :- In this Program, we have to do summation of Two numbers , Without the use of variable that has the value. We have to use their memory Address and with the use of address we will find that which value is stored at that memory address. First we have to declare two types of Variables :- First is Normal Variable Second is pointer variable We Have to Declare Two Normal Int variables and two pointer variables So that we can store

#3 | Pointers | Write a program to declare pointer variable that display the value of another variable. | C Language

Image
CompTech YouTube Video Query Write a program to declare pointer variable that display the value of another variable. Code #include <stdio.h> void main() {     // Declare Varriables     int a;     int *p;     // Assign Value to the Variable a     printf( "Enter The Value of Variable a :- " );     scanf( "%d" ,&a);     // assign the address of varriable a to the pointer variable p     p = &a;     // print value of variable a     printf( "\nValue of a = %d" ,*p); } Output Enter The Value of Variable a :- 4 Value of a = 4 Description First We Have To Declare Two Variables... First is Normal Int Variable a. Second is Pointer variable p.  With use of  * (star) before variable name we can declare pointer variable After That we have to initlize  the value to the variable a , so that it will allocate to the memory After initilization we will assign the address of variable a to the pointer variable p Now Pointer variable p has the address of variab

#2 | Pointers | Display Memory Address of Different Data Types | C Language

Image
! Welcome To CompTech ! My Name is Pratham Rathod and  i am the host of CompTech Youtube Channel  and This Website.  YouTube Video Query Write a program to display memory address of different data types. Code #include <stdio.h> void main() {     // declare different data types varriables and initilize them     int a = 10 ;     float b = 10.12 ;     char c = 'c' ;     double d = 10000000000 ;     // printing memory addresses of different data types     printf( "Address of %d is %u\n" ,a,&a);     printf( "Address of %.2f is %u\n" ,b,&b);     printf( "Address of %c is %u\n" ,c,&c);     printf( "Address of %lf is %u\n" ,d,&d); } Output Address of 10 is 6422300 Address of 10.12 is 6422296 Address of c is 6422295 Address of 10000000000.000000 is 6422280 Description This is Very Easy To Learn Program . Here, We Have to Declare Variables With Different Data Types. And Also We Have to Initialize Them With There Respectiv

#1 | Pointers | Write a program to input any variable and display its address | C Language

Image
Welcome To CompTech  I am Pratham Rathod  Host Of CompTech YouTube Channel And This Blog Spot. We are Learning Pointer's In C Programming Language in This Series. First Practical YouTube Video :-     Query That Solved In This Video :- Write a Program to Input Any Variable and Display It's Memory Address.