Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdlib.h>
- #include <stdio.h>
- #include <time.h>
- #define n 5
- typedef struct {
- double Re;
- double Im;
- } complex_t;
- int main()
- {
- srand(time(0));
- complex_t *wsk;
- complex_t *wsk2;
- wsk = calloc(wsk, n*sizeof(complex_t));
- wsk2 = calloc(wsk, n*sizeof(complex_t));
- for(int i=0; i<n; i++)
- {
- wsk[i].Re = rand()%10;
- wsk[i].Im = rand()%10;
- }
- for(int i=0; i<n; i++)
- {
- wsk2[i].Re = wsk[i].Im;
- wsk2[i].Im = wsk[i].Re;
- }
- for(int i=0; i<n; i++)
- {
- printf("%f %f\n", wsk[i].Re, wsk[i].Im);
- printf("%f %f\n", wsk2[i].Re, wsk2[i].Im);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement