-->

Program to show a character pointer

using codeblocks
-------------------------------------------------------------------------

//understanding pointer for a character             //comment of program
#include <stdio.h>                     //header file
int main()
{
    char *pointer;                      //pointer declaration of character type
    char x='a';                           //value assignment of character type
    pointer=&x;                        //assigning address to that pointer
    printf("the address of x is=%d\n",pointer);//display of that address
    printf("the  value of x=%c",*pointer);   
//display of value stored in that address. we display that using indirection operator
    return 0;
}

---------------------------------------------------------------------------------------------
using turbo c++
------------------------------------------------------------------------------------------
//understanding pointer for a character             //comment of program
#include <stdio.h>                     //header file
#include<conio.h>
int main()
{
    char *pointer;                      //pointer declaration of character type
    char x='a';                           //value assignment of character type
    pointer=&x;                        //assigning address to that pointer
    printf("the address of x is=%d\n",pointer);//display of that address
    printf("the  value of x=%c",*pointer);   
 //display of value stored in that address. we display that using indirection operator
   getch();
    return 0;
}

No comments:

Post a Comment