by Dinesh Thakur Category: Function and Pointer
#include <stdio.h>
void main()
{
  int x, y, Area, Perimeter;
  int *ptrx = &x ;
  int *ptry = &y;
  clrscr();
  printf("Enter the sides of a rectangle");
  scanf("%d %d", ptrx, ptry );
  printf("x = %d\t y = %d\n",*ptrx, *ptry);
  Area = *ptrx * *ptry;
  Perimeter= 2*(*ptrx + *ptry);
  printf("Area of rectangle= %d\n" ,Area);
  printf("Perimeter = %d\n", Perimeter);
}
The expected output is as given below. The output is obvious
C Program to computes the area and perimeter of a rectangle using pointers.



About Dinesh Thakur

Dinesh ThakurDinesh Thakur holds an B.SC (Computer Science), MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps. For any type of query or something that you think is missing, please feel free to Contact us.



Related Articles