반응형
What is the difference between char s[] and char *s in C?
http://stackoverflow.com/questions/1704407/what-is-the-difference-between-char-s-and-char-s-in-c
How is read-only memory implemented in C?
http://stackoverflow.com/questions/1704893/how-is-read-only-memory-implemented-in-c
http://effserv.tistory.com/131
// This is allocated from the heap with the C++ "new" operator // It's read-write // You must use "delete" to dispose of it char* str1 = new char[20]; // This is allocated from the heap with the C "malloc()" function // It's also read-write // You must use "free()" to dispose of it char* str2 = malloc (20); // This is allocated from the stack // It, too, is read-write // It's disposed of when then block exits (usually, at the end of the function) char* str3[20]; // This is a constant // It is READ-ONLY // You MUST NOT try to write to it! char* str4 = "Hi.123456789";
반응형
'C & C++' 카테고리의 다른 글
문자열을 구성하는 character ascii code 합( sum ) 구하기. (0) | 2014.08.23 |
---|---|
문자열 구성하는 character & ascii code 순서대로 출력하기 (0) | 2014.08.23 |
visual studio 2013 에서 C/C++ 명령행 인수 넣기 (0) | 2014.07.14 |
ascii, MBCS, unicode 기본 함수 비교 (0) | 2014.06.24 |
_tcsclen, _tcslen, strlen,wcslen, lstrlen (0) | 2014.04.19 |