I know when I have to print I use p->real
and so on but what should I write when I am reading numbers using scanf
?
#include <stdio.h>
typedef struct {
int real;
int imaginary;
} complex;
void read(complex*);
void main() {
complex c;
read(&c);
}
void read(complex* p){
/*what to write in scanf*/
}
You can write:
scanf("%d %d", &p->real, &p->imaginary);
but that depends heavily on the format in which the numbers come.