C語言指標練習

2021-10-12 03:12:58 字數 1816 閱讀 5453

#include

/**函式作用:將指標傳入,連續輸出len個位元組其中的內容

*返回引數:無

*/void

pointer_output

(char

* buf,

char len)

//傳入宣告只能傳入char型別的指標}/*

*函式作用:將傳入的值遞減傳入陣列內

*傳入引數:無符號整形

*/char

*itoa

(unsigned

char num)

printf

("\n");

printf

("\n");

return test;

}int

main()

}------

----

----

----

----

----

----

----

----

----

----

----

----

----

----

----

----

----

----

----

-cmd輸出結果:

test addr:

0xd4a464

++++

++++

++++

++test addr:

0xd4a465

++++

++++

++++

++test addr:

0xd4a466

++++

++++

++++

++test addr:

0xd4a467

++++

++++

++++

++test addr:

0xd4a468

++++

++++

++++

++output buf:

0xd4a464

buf[0]

=5----

----

----

buf[1]

=4----

----

----

buf[2]

=3----

----

----

buf[3]

=2----

----

----

buf[4]

=1----

----

----

output *rxbuf:

0x5output rxbuf:

0xd4a464

----

----

----

output *rxbuf:

0x4output rxbuf:

0xd4a465

----

----

----

output *rxbuf:

0x3output rxbuf:

0xd4a466

----

----

----

output *rxbuf:

0x2output rxbuf:

0xd4a467

----

----

----

output *rxbuf:

0x1output rxbuf:

0xd4a468

----

----

----

C語言指標練習

總時間限制 1000ms 記憶體限制 65536kb 在此處補充你的 描述 填寫記憶體交換函式 swapmemory,使得程式輸出指定結果 include using namespace std void swapmemory void m1,void m2,int size void printi...

C語言指標練習1

1.指標的用法示例。include include void main 2.通過指標間接將乙個變數值賦給另乙個變數。include include void main 3.使兩個指標指向同乙個變數。include include void main 5.指向陣列的指標。include void ma...

C語言 指標練習 2

int main 輸出結果 ff ff ff fc 4 分析 int main int ptr1 int aa 1 int ptr2 int aa 1 printf d d ptr1 1 ptr2 1 return 0 輸出結果 10 5 分析 aa,取的是二維陣列的位址,加1,跳過整個陣列,指向了...