realloc/calloc

切記切記,兩個的 parameter 不太一樣,我老是忘記,然後就 Segmenation fault :roll:

word_freq = (char*)calloc(i , sizeof(char));
word_freq = (char*)realloc(word_freq,i * sizeof (char));
Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • funp
  • Haohao
  • Hemidemi
  • Live
  • MisterWong
  • TwitThis
  • udn
 

Leave a reply

Creative Commons Attribution-NonCommercial-ShareAlike 2.5 Taiwan
Creative Commons Attribution-NonCommercial-ShareAlike 2.5 Taiwan