第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
#include <string.h>
#include <iostream>
using namespace std;
int main(void)
{
//在堆中申請(qǐng)100個(gè)char類型的內(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 <string.h>
#include <iostream>
using namespace std;
int main(void)
{
//在堆中申請(qǐng)100個(gè)char類型的內(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;
}javascript:;
//const
#include <iostream>
using namespace std;
int main(void)
{
//定義常量count
const int count = 3;
const int *p = &count;
//打印count次字符串Hello imooc
for(int i = 0; i < *p; i++)
{
cout << "Hello imooc" << endl;
}
return 0;
}
#include <iostream>
using namespace std;
int main(void)
{
int x = 3;
//定義引用,y是x的引用
int &y = x;
//打印x和y的值
cout << x << y << endl;

//修改y的值
y = 4;
//再次打印x和y的值
cout << x << y << endl;
return 0;
}
我更喜歡這樣寫
int* p=new int[10];
delete[] p;
已通過
#include <string.h>
#include <iostream>
using namespace std;
int main(void)
{
//在堆中申請(qǐng)100個(gè)char類型的內(nèi)存
char *str = new char[100];
//拷貝Hello C++字符串到分配的堆中的內(nèi)存中
strcpy(*str, "Hello imooc");
//打印字符串
cout<<*str<<endl;
//釋放內(nèi)存
delet []str;
str=NULL;
return 0;
}
int getMax(int *arr,int count)
{
int maxNum=arr[0];
for(int i = 1; i < count; i++)
{
if(arr[i]>maxNum)
{
maxNum=arr[i];
}
}
return maxNum;
}

int main(void)
{
int numArr[3] = {3, 8, 6};
cout << getMax(5, 6) << endl;
cout << getMax(numArr,3)<< endl;
return 0;
這節(jié)課太難懂了,把C的指針和這里的引用都弄混了

最新回答 / 咕嚕嘟咚
我也不太清楚,應(yīng)該是因?yàn)樵谡{(diào)用函數(shù)時(shí)會(huì)自動(dòng)為里面的參數(shù)賦值(賦自己輸入的值)吧

最新回答 / 慕粉1527144879
?"http://比較變量與下一個(gè)元素的大小"這行代碼下你arr寫出arrr,并且你這樣寫結(jié)果應(yīng)該是6,8才是啊,
James老師的比喻很恰當(dāng),哈哈
不錯(cuò)不錯(cuò),收獲良多
講的很好,但是感覺內(nèi)容有點(diǎn)少
//const
#include <iostream>
using namespace std;
int main(void)
{
//定義常量count
const int count = 3;
const int *p = & count;
//打印count次字符串Hello C++
for(int i = 0; i < count; i++)
{
cout << "Hello imooc" << endl;
}
return 0;
}
課程須知
本課程是C++初級(jí)課程 熟練掌握C語言開發(fā)語言基礎(chǔ)語法
老師告訴你能學(xué)到什么?
1、C++語言引用的魅力 2、C++語言const的用法 3、C++語言函數(shù)默認(rèn)值及函數(shù)重載 4、C++語言內(nèi)存管理

微信掃碼,參與3人拼團(tuán)

微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)

友情提示:

您好,此課程屬于遷移課程,您已購(gòu)買該課程,無需重復(fù)購(gòu)買,感謝您對(duì)慕課網(wǎng)的支持!

本次提問將花費(fèi)2個(gè)積分

你的積分不足,無法發(fā)表

為什么扣積分?

本次提問將花費(fèi)2個(gè)積分

繼續(xù)發(fā)表請(qǐng)點(diǎn)擊 "確定"

為什么扣積分?

舉報(bào)

0/150
提交
取消