Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- struct ComplexNo
- {
- double real;
- double img;
- };
- typedef struct ComplexNo ComplexNo;
- struct ComplexArray
- {
- ComplexNo **arr;
- int size;
- };
- typedef struct ComplexArray ComplexArray;
- void main()
- {
- ComplexArray a;
- a.arr = (ComplexNo**)malloc(sizeof(ComplexNo*)*3);
- for(int i=0;i<3;i++)
- {
- a.arr[i] = (ComplexNo*)malloc(sizeof(ComplexNo));
- a.arr[i]->real = i;
- a.arr[i]->img = i+1;
- }
- for(int i=0;i<3;i++)
- {
- printf("%lf + %lfi\n", a.arr[i]->real, a.arr[i]->img);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement