#include <iostream>
using namespace std;
int main()
{
int a;
cin >> a;
int b[a]={0};
}
C++에서 동적할당 막 배우는데 이런것도 프로그램 실행중에 b배열이 메모리에 할당되니까 동적할당으로 봐야해?
그럼 스택영역 말고 힙영역에 들어가는거야?
근데 delete b delete[] b 하니까 에러나더라
#include <stdio.h>
int main()
{
int input, i;
scanf("%d",&input);
int b[input];
for(i=0 ; i<input ; i++)
scanf("%d",&b[i]);
for(i=0 ; i<10 ; i++)
printf("%d ",b[i]);
}
그리고 방금 C로 컴파일했는데 이게 된다. 왜 되는건지 이해안됌ㄷㄷ
아 보기힘들어;;
첫번째는 스택에 들어가서 동적할당아님 글고 두번째는 문법 바뀜 C99이후였나? 나도 잘 모르는데 쨋든 이제 허용