Created
June 5, 2015 18:15
-
-
Save toanalien/50d4296595e98f9bb83b to your computer and use it in GitHub Desktop.
pointer point to struct
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#define MAX 10 | |
typedef struct SSTUDENT | |
{ | |
char Name[10]; | |
float Mark; | |
struct SSTUDENT *pNext; | |
} STUDENT, *PSTUDENT; | |
int HashFunc(char str[]) | |
{ | |
int i, n = strlen(str); | |
int m = 0; | |
for (i = 0; i < n; i++) | |
m = (m * 29 + (str[i] - 'A')) % MAX; | |
return m; | |
} | |
int main() | |
{ | |
FILE *src_file; | |
PSTUDENT st; | |
char s[15]; | |
int count = 0; | |
src_file = fopen("DSSinhvien.txt", "r"); | |
if (fgets(s,15,src_file)!=NULL) | |
count = atoi(s); | |
st = (STUDENT*)(malloc(count)); | |
/* | |
while (fgets(s,15,src_file)!=NULL) | |
{ | |
}*/ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment