c - int to structure member is not working -
typedef struct { int row; int col; int max_gray; int **matrix; } pgmdata; void readpgm(const char *file_name, pgmdata *data) { file *pgmfile; char version[3]; int i, j, tmp; int lo, hi; skipcomments(pgmfile); fscanf(pgmfile, "%d", &tmp); printf("d"); data->col=tmp; // error here printf("d"); skipcomments(pgmfile); fscanf(pgmfile, "%d", &tmp); data->row=tmp; skipcomments(pgmfile); fscanf(pgmfile, "%d", &tmp); data->max_gray=tmp; fgetc(pgmfile); }
hello. seek assign int tmp struct data's col can not show when printf
printf("%d",data->col);
instead of ->
, used .
said not structure. because construction pointer ->
can utilize think.
in code write error here. prints first d
cant print sec d
, programme shuts down. error?
i set & tmp still same.
c struct
No comments:
Post a Comment