ã¯ããã« CãC++ã§ããç¨åº¦å¤§ããªããã°ã©ã ãæ¸ãå ´åï¼æ大ã®åé¡ç¹ã¯ ã¡ã¢ãªç®¡çã§ããï¼è¤éãªããã°ã©ã ã®å ´åï¼å¿ è¦ãªã¡ã¢ãªã®éã ãããããè¦ç©ã£ã¦ããã®ãé£ããããï¼ã¡ã¢ãªãå¿ è¦ã«ãªã£ã æç¹ã§ã¡ã¢ãªã確ä¿ãï¼ä¸è¦ã«ãªã£ããããã解æ¾ããã¨ãã ããã°ã©ãã³ã°ã¹ã¿ã¤ã«ãä¸è¬çã ï¼Cã§è¨ãã°ãããªæãã ï¼ char *x; ... x = (char*)malloc(n*sizeof(char)); ... x ã使ã£ã¦ä»äºããã ... free(x); ãã®ããã°ã©ãã³ã°ã¹ã¿ã¤ã«ã®åé¡ç¹ã¯ï¼ããã¾ãã«è¨ã£ã¦ ãããªã¨ããã ããï¼ free(x) ãå¿ããã¨ï¼ããã»ã¹ãã©ãã©ã大ãããªã£ã¦ãã¾ãï¼ free() ãã¦ã¯ãããªããã®ãééã£ã¦free()ãã(ãã¨ãã°ï¼åã ã¡ã¢ãªã2å free() ãã¦ãã¾ãã¨ã)ã¨ï¼ãã® free() ã®ä¸ã§ãªãï¼ å ¨ç¶éãå ´æã§ã¨ã©ã¼ãçºçã
{{#tags}}- {{label}}
{{/tags}}