Skip to content

Instantly share code, notes, and snippets.

@toanalien
Created June 5, 2015 18:15
Show Gist options
  • Save toanalien/50d4296595e98f9bb83b to your computer and use it in GitHub Desktop.
Save toanalien/50d4296595e98f9bb83b to your computer and use it in GitHub Desktop.
pointer point to struct
#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