#include<iostream.h>
int main(void)
{
const count=3;
const *p=&count;
for(int i=0;i<=*p;i++)
{
cout<<"hello,world"<<endl;
}
return 0;
}
int main(void)
{
const count=3;
const *p=&count;
for(int i=0;i<=*p;i++)
{
cout<<"hello,world"<<endl;
}
return 0;
}
#include <string.h>
#include <iostream>
using namespace std;
int main(void)
{
//在堆中申請(qǐng)100個(gè)char類(lèi)型的內(nèi)存
char *str = new char[100];
//拷貝Hello C++字符串到分配的堆中的內(nèi)存中
strcpy(str, "Hello imooc");
//打印字符串
cout<<str<<endl;
//釋放內(nèi)存
delete str;
str=NULL;
return 0;
}
#include <iostream>
using namespace std;
int main(void)
{
//在堆中申請(qǐng)100個(gè)char類(lèi)型的內(nèi)存
char *str = new char[100];
//拷貝Hello C++字符串到分配的堆中的內(nèi)存中
strcpy(str, "Hello imooc");
//打印字符串
cout<<str<<endl;
//釋放內(nèi)存
delete str;
str=NULL;
return 0;
}
#include<iostream.h>
int main(void)
{
int x=3;
int &y=x;
cout<<"x="<<x<<",y="<<y<<endl;
y=4;
cout<<"x="<<x<<",y="<<y<<endl;
}
int main(void)
{
int x=3;
int &y=x;
cout<<"x="<<x<<",y="<<y<<endl;
y=4;
cout<<"x="<<x<<",y="<<y<<endl;
}
c 語(yǔ)言{
申請(qǐng) void *malloc(size_t size);
釋放 void free(void *memblock);
}
申請(qǐng) void *malloc(size_t size);
釋放 void free(void *memblock);
}
2017-08-03
#include <string.h>
#include <iostream>
using namespace std;
int main(void)
{
//在堆中申請(qǐng)100個(gè)char類(lèi)型的內(nèi)存
char *str = new char[100];
//拷貝Hello C++字符串到分配的堆中的內(nèi)存中
strcpy(*str, "Hello imooc");
//打印字符串
cout<<*str<<<endl;
//釋放內(nèi)存
delete str;
str = NULL;
return 0;
}
#include <iostream>
using namespace std;
int main(void)
{
//在堆中申請(qǐng)100個(gè)char類(lèi)型的內(nèi)存
char *str = new char[100];
//拷貝Hello C++字符串到分配的堆中的內(nèi)存中
strcpy(*str, "Hello imooc");
//打印字符串
cout<<*str<<<endl;
//釋放內(nèi)存
delete str;
str = NULL;
return 0;
}
int *p = new int(1);
delete p;
p = NULL;
int *p = new int[1];
delete []p;
p = NULL;
delete p;
p = NULL;
int *p = new int[1];
delete []p;
p = NULL;
2017-08-01
#include <iostream>
using namespace std;
int main(void)
{
int x = 3;
//定義引用,y是x的引用
int &y = x;
//打印x和y的值
cout<<x<<endl;
cout<<y<<endl;
//修改y的值
y = 1;
//再次打印x和y的值
cout<<x<<endl;
cout<<y<<endl;
return 0;
}
using namespace std;
int main(void)
{
int x = 3;
//定義引用,y是x的引用
int &y = x;
//打印x和y的值
cout<<x<<endl;
cout<<y<<endl;
//修改y的值
y = 1;
//再次打印x和y的值
cout<<x<<endl;
cout<<y<<endl;
return 0;
}
結(jié)果要有6哦 所以第一個(gè)函數(shù) 結(jié)果最大要是6哦 舉一反三 活學(xué)活用嘛