[語法] 看不懂的程式碼
關於動態記憶分布:
#include <iostream>
#include <cstdlib>
using namespace std;
int main()
{
unsigned int no_of_size;
int *ptint,i;
cout<<"Input no of data :\n";
cin>>no_of_size;
ptint=(int *)calloc(no_of_size,sizeof(int));
if( ptint == NULL)
{
cout<<"No memory space for input data \n";
exit(1);
}
cout<<"Input the integer data \n";
for(i=0; i< no_of_size; ++i)
cin>>*(ptint+i);
cout<<"The input integer data are :\n";
for(i=0; i < no_of_size; ++i)
cout<<*(ptint+i)<<", ";
cout<<"\n";
free(ptint);
return 0;
}
我真的看不懂這個程式在做什麼... T^T
煩請高手解惑
感謝 m(_ _)m
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.112.218.78
推
05/18 22:41, , 1F
05/18 22:41, 1F
→
05/18 22:44, , 2F
05/18 22:44, 2F
→
05/18 22:46, , 3F
05/18 22:46, 3F
→
05/18 22:54, , 4F
05/18 22:54, 4F
推
05/19 01:00, , 5F
05/19 01:00, 5F
→
05/19 01:00, , 6F
05/19 01:00, 6F
→
05/19 01:01, , 7F
05/19 01:01, 7F
→
05/19 01:01, , 8F
05/19 01:01, 8F
→
05/19 06:15, , 9F
05/19 06:15, 9F
C_and_CPP 近期熱門文章
PTT數位生活區 即時熱門文章