hi,
i wrotte a code but doesn't work..since i'm beginner i can't find where is my error..when i compile my code i get no error..but when i run it i get: Segmentation fault
thx in advance for ur help
code:
Code:#include <stdio.h> #include <stdlib.h> struct Complex_s{ double x; double y; }; void readComplex(struct Complex_s *z); // 1 void printComplex(struct Complex_s *z); // 2 int main(int argc, char *argv[]) { struct Complex_s z1; printf("Number: \n"); readComplex(&z1); printComplex(&z1); return 0; } void readComplex(struct Complex_s *z) { printf("R-Part: \n"); scanf("%lf", z->x); printf("I-part: \n"); scanf("%lf", z->y); } void printComplex(struct Complex_s *z) { printf("%lf, %lfi\n", z->x, z->y); }



LinkBack URL
About LinkBacks



thx vart..