#include <stdio.h>
#include <stdlib.h>

typedef unsigned short word;

typedef struct headerInfo{
        int tsize;
        int count;
        int rsize;
}headinf;
        
typedef struct dataRec{
        long time;
        word oppid;
        word opppt;
        float before;
        float after;
        int ntrNum;
        int tapNum;
        int cbNum;
}drec;

int main(){
    
    headinf *inf;
    drec *rec;
    
    FILE *fp;
    
    fp=fopen(\"KJM1\", \"a\");
    int i;
    
    for(i=1; i <= 100; i++){
                     
                     
                     inf->count = i;
                     rec->time, rec->oppid, rec->opppt, rec->before, rec->after, rec->ntrNum, rec->tapNum, rec->cbNum = i;
                     
                     fprintf(fp, \"%s\\n%s\\n%s\\n%s\\n%s\\n%s\\n%s\\n%s\\n\", rec->time, rec->oppid, rec->opppt, rec->before, rec->after, rec->ntrNum, rec->tapNum, rec->cbNum);
                     
                     inf->rsize = sizeof(rec);
                     inf->tsize = inf->count * inf->rsize;
                     
                     fprintf(fp, \"%s\\n%s\\n%s\\n\", inf->tsize, inf->count, 
                     inf->rsize);
    }
    
    fclose(fp);
    
    system(\"pause\");
    return 0;
}


아직 포인터개념이 미숙해서 힘드네

디버깅 해보니깐 inf->count = i; 요부분에서 세그먼트 폴트가 발생하더라고... 근데 이유를 잘 모르겠어;;;;

그리고 요부분 rec->time, rec->oppid, rec->opppt, rec->before, rec->after, rec->ntrNum, rec->tapNum, rec->cbNum = i;

구조체의 각 변수에다가 일괄적으로 inf->count값을 넣고싶은데 방법 없어? ㅠㅠ

조언좀 해줘 횽들