-->

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;
}

Program to show use of pointer.

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

//understanding pointer                //comment of program
#include <stdio.h>                     //header file
int main()
{
    int *pointer;                      //pointer declaration
    int x=4;                           //value assignment
    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=%d",*pointer);    //display of value stored in that address. we display that             using indirection operator
    return 0;
}

------------------------------------------------------------------------------------
using tuboc++
--------------------------------------------------------------------------------------
//understanding pointer                //comment of program
#include <stdio.h>                     //header file
#include<conio.h>
int main()
{
    int *pointer;                      //pointer declaration
    int x=4;                           //value assignment
    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=%d",*pointer);    
//display of value stored in that address. we display that using indirection operator
   getch();
    return 0;
}

program to show total bytes used by union ,using sizeof().

using codeblocks
-------------------------------------------------------------------------
//sizeof  union with some data
#include <stdio.h>                         //header file
union det                                  //union tag
{
    char name[30];                      //first member
    char address[70];                   //second member
    int roll_no;                        //third member
}acc;                                   //data variable
int main()
{
    printf("total  SIZE=%d",sizeof(acc));//prints total bytes occupied by variable 'acc'.
    return 0;
}

//note: it finds the sum of all members with the largest one and other.
-------------------------------------------------------------------------------------------------------

using turbo c++
----------------------------------------------------------------------------------------------
//sizeof  union with some data
#include <stdio.h>                         //header file
#include<conio.h
union det                                  //union tag
{
    char name[30];                      //first member
    char address[70];                   //second member
    int roll_no;                        //third member
}acc;                                   //data variable
int main()
{
    printf("total  SIZE=%d",sizeof(acc));//prints total bytes occupied by variable acc.
    getch();
    return 0;
}