C

Monday, 26 June 2017

Program to demonstrate use of union


#include<stdio.h>
main()
{
          union a

          {
                 short int i;
                   char ch[2];

          };

          union a key;

          key.i=512;
          clrscr();
          printf("key.i=%d\n",key.i);
          printf("key.ch[0]=%d\n",key.ch[0]);
          printf("key.ch[1]=%d\n",key.ch[1]);
          return 0;

}

No comments:

Post a Comment

Write a program to draw a circle using mid-point circle drawing algorithm.

#include<iostream.h> #include<graphics.h> #include<conio.h> void drawcircle(int x0, int y0, int r) {         ...