Define a structure to represent complex number in c
Answers
Here's a copy of my code,
#include<stdio.h>
typedef struct complex1{
float *real1;
float *imaginary1;
} complex1;
typedef struct complex2{
float *real2;
float *imaginary2;
} complex2;
int main(){
struct complex1 real;
struct complex1 *realptr;
struct complex1 imaginary;
struct complex1 *imaginaryptr;
struct complex2 real;
struct complex2 *realptr;
struct complex2 imaginary;
struct complex2 *imaginaryptr;
printf("Please enter variable x1.");
scanf("%d", &real.real1);
printf("Please enter variable y1.");
scanf("%d", &imaginary.imaginary1);
printf("Please enter variable x2.");
scanf("%d", &real.real2);
printf("Please enter variable y2.");
scanf("%d", &imaginary.imaginary2);
printf("You have entered: %d,%d,%d,%d\n",
real.real1, imaginary.imaginary1,real.real2, imaginary.imagnary2);
return 0;
}