Search This Blog

Wednesday, 2 March 2022

B3. C Program to demonstrate pointers in C

 /* B3. C Program to demonstrate pointers in C */
#include<stdio.h>

void main()
{
    int i=10, *ip;
    float f=3.4, *fp;
    char c='a', *cp;

    clrscr();

    printf("i=%d\n",i);
    printf("f=%f\n",f);
    printf("c=%c\n",c);

    ip=&i;
    printf("\nAddress of i=%u\n", ip);
    printf("Value stored in i=%d\n", *ip);

    fp=&f;
    printf("\nAddress of f=%u\n", fp);
    printf("Value stored in f=%f\n", *fp);

    cp=&c;
    printf("\nAddress of c=%u\n", cp);
    printf("Value stored in c=%c\n", *cp);

    getch();
}

No comments :

Post a Comment

FREE Hit Counters