반응형
https://stackoverflow.com/questions/605845/do-i-cast-the-result-of-malloc/605858#605858
Do I cast the result of malloc?
In this question, someone suggested in a comment that I should not cast the result of malloc. i.e., I should do this: int *sieve = malloc(sizeof(int) * length); rather than: int *sieve = (int *) m...
stackoverflow.com
Why does this code segfault on 64-bit architecture but work fine on 32-bit?
I came across the following C puzzle: Q: Why does the following program segfault on IA-64, but work fine on IA-32? int main() { int* p; p = (int*)malloc(sizeof(int)); *p = 1...
stackoverflow.com
반응형
'Dev > C, C++' 카테고리의 다른 글
[ C ] 포인터 변수가 가리키는 문자열 또는 배열의 길이 구하기 (2) | 2021.12.26 |
---|---|
[VSCode / C / C++] VSCode에서 Makefile 사용하기 (0) | 2021.12.17 |
[ C ] char 포인터가 malloc으로 할당된 메모리보다 더 많은 데이터를 저장하는 이유 (1) | 2021.10.18 |