C Program for pointer comparison


// C Program for pointer comparison


#include<stdio.h>
#include<conio.h>
void main()
{
  int a,b,*ptr1,*ptr2;
  clrscr();
  printf("Enter values for a and b: ");
  scanf("%d%d",&a,&b);
  ptr1=&a;
  ptr2=&b;
  ptr1=(int *)a;
  ptr2=(int *)b;
 if(ptr1>ptr2)
   {
   printf("ptr1 is greater");
   }
 else
  {
  printf("ptr2 is greater");
  }
getch();
}

==========================
OUTPUT:-

Enter values for a and b: 6000 2000
ptr1 is greater     

==========================
                            
C Program for pointer comparison
                              

Comments