Pointer Comparison in C

0 June 15, 2021

In this example, We will learn a simple program for pointer comparision. Before that, You must have knowledge of the following topics.

Download Application: Learn C Programming with Live Compiler

CODE

#include <stdio.h>

int main()
{
    int *ptrA,*ptrB;

    ptrA = (int *)1;
    ptrB = (int *)2;
    
    if(ptrA > ptrB)
        printf("PtrB is greater than ptrA");
    else
        printf("PtrB is less than ptrA");

    return(0);
}

The output of above program is

PtrB is less than ptrA
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments

Join Our Newsletter Now

Get the latest tutorials, examples and projects updates.

Ads Block Detector Powered by codehelppro.com

Ads Blocker Detected!!!

We have detected that you are using extensions to block ads. Please support us by disabling these ads blocker.

Disable Ad Block

Want Same System