影音先锋男人资源在线观看,精品国产日韩亚洲一区91,中文字幕日韩国产,2018av男人天堂,青青伊人精品,久久久久久久综合日本亚洲,国产日韩欧美一区二区三区在线

大連東軟信息學(xué)院大一上 電子工程 c語言-實(shí)驗(yàn)第六次,第十二周

上傳人:沈*** 文檔編號:146644205 上傳時間:2022-08-31 格式:DOC 頁數(shù):7 大小:235.50KB
收藏 版權(quán)申訴 舉報 下載
大連東軟信息學(xué)院大一上 電子工程 c語言-實(shí)驗(yàn)第六次,第十二周_第1頁
第1頁 / 共7頁
大連東軟信息學(xué)院大一上 電子工程 c語言-實(shí)驗(yàn)第六次,第十二周_第2頁
第2頁 / 共7頁
大連東軟信息學(xué)院大一上 電子工程 c語言-實(shí)驗(yàn)第六次,第十二周_第3頁
第3頁 / 共7頁

下載文檔到電腦,查找使用更方便

10 積分

下載資源

還剩頁未讀,繼續(xù)閱讀

資源描述:

《大連東軟信息學(xué)院大一上 電子工程 c語言-實(shí)驗(yàn)第六次,第十二周》由會員分享,可在線閱讀,更多相關(guān)《大連東軟信息學(xué)院大一上 電子工程 c語言-實(shí)驗(yàn)第六次,第十二周(7頁珍藏版)》請在裝配圖網(wǎng)上搜索。

1、Lab7 Pointers OBJECTIVES After completing this experiment, you will be able to: ? Understand pointers fundamentals ? Understand functions and pointers ? Pass arrays to functions ? Use pointers to One-Dimensional Arrays PROCEDURES 1. What format speci?ers (in order) should be used in the

2、printf() statement in the following program? Note that in the program the correct format speci?ers have been replaced by Z. #include int main(void) { int x = 5; int *x_ptr = &x; printf("%Z, %Z, %Z, %Z\n", x, *x_ptr, &x, x_ptr); } Your answers:(2 Marks) %d,%d,%p,%p —————————————

3、————— Print Screen of Result: (3 Marks) 2. On a machine in which addresses are 2 bytes, what is printed by the following program: #include int main(void) char fun[] = "Programming is fun."; char favorite[] = "My favorite class is programming."; char *x = fun; printf("%d\n

4、", sizeof(fun)); printf("%d\n", sizeof(favorite)); printf("%d\n", sizeof(x)); } Your answers:(2 Marks) 20 34 2 —————————————————— Print Screen of Result: (3 Marks) 3. Rewrite the following program, replacing the subscript (index) notation with the corresponding pointer notation. Only c

5、hange the parts of the program necessary for the replacement. #include int main(void) { int data[] = {1, 2, 3, 4, 5, 6}; int i; for(i = 0; i < 6; i++) printf("%2d", data[i]); } Print Screen of Code: (6 Marks) —————————————————— Print Screen of Result: (3 Marks) ————————————

6、—————— 4. Rewrite the following program such that the function has a return type of void and the variable y gets its value using pointers. #include int dbl(int num); int main(void) { int x = 13; x = dbl(x); printf("x doubled is %d\n", x); } int dbl(int num) { return 2*num;

7、 } Print Screen of Code: (6 Marks) —————————————————— Print Screen of Result: (3 Marks) —————————————————— 5. Write a program that uses pointers to pass a character array A to a function. The function will change all characters to uppercase,Please write different two programs in the followi

8、ng cases: (1)The return type of the function should be pointer of char type. (2)The return type of the function should be void. The elements of the array should be printed from main() after the function call. Compare the differences between two program. (1)Print Screen of Code: (6 Marks)

9、 —————————————————— Print Screen of Result: (3 Marks) (2)Print Screen of Code: Print Screen of Result: Describe the differences between the two programs: (3 Marks) First program ,the type of return value is points,it pass by reference and use return points

10、value. Second program the type of return value is void.it pass by value. —————————————————— 6. Write a program that declares a 1D array of integers. The program calls a function, passing it the array, the number of elements in the array, and the addresses of two variables, evensum and o

11、ddsum, for storing integers. The function produces two sums: the sum of the even integers in the array data and the sum of the odd integers in the array data. Pointers are used to update the values of evensum and oddsum declared in main(). Print Screen of Code: (6 Marks) —————————————————— Print Screen of Result: (3 Marks) ——————————————————

展開閱讀全文
溫馨提示:
1: 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
2: 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
3.本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
5. 裝配圖網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

相關(guān)資源

更多
正為您匹配相似的精品文檔
關(guān)于我們 - 網(wǎng)站聲明 - 網(wǎng)站地圖 - 資源地圖 - 友情鏈接 - 網(wǎng)站客服 - 聯(lián)系我們

copyright@ 2023-2025  zhuangpeitu.com 裝配圖網(wǎng)版權(quán)所有   聯(lián)系電話:18123376007

備案號:ICP2024067431-1 川公網(wǎng)安備51140202000466號


本站為文檔C2C交易模式,即用戶上傳的文檔直接被用戶下載,本站只是中間服務(wù)平臺,本站所有文檔下載所得的收益歸上傳人(含作者)所有。裝配圖網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對上載內(nèi)容本身不做任何修改或編輯。若文檔所含內(nèi)容侵犯了您的版權(quán)或隱私,請立即通知裝配圖網(wǎng),我們立即給予刪除!