--- tags: 系統程式 --- # **系統程式ch2、3:電腦的硬體結構、組合語言** **[以下圖片來自陳鍾誠老師網站教材](http://ccckmit.wikidot.com/)** ![](https://i.imgur.com/y5FjwZh.jpg) ![](https://i.imgur.com/1WrWpe9.jpg) ![](https://i.imgur.com/Td0r410.jpg) ![](https://i.imgur.com/4uKSLaO.jpg) ### 指標範例 ```c= #include <stdio.h> char a[10]; int c= 2; int *cptr= &c; char b[] = "Hello world"; char *aptr =a, *bptr=b; // *aptr = *bptr; int main(){ printf("0x%p 0x%p 0x%p 0x%p\n ",bptr,&b,cptr,&c);//位置 printf("%s %d",bptr,cptr);//Hello world // 0x0040401C 0x0040400C 0x00404004 0x00404004 // Hello world 4210692 } ``` ### 字串複製-指標 ```c= #include <stdio.h> char a[10]; char b[] = "Hello world"; char *aptr =a, *bptr=b; int main(){ while(1){ *aptr = *bptr; printf("a =%c b= %c \n ",*aptr,*bptr); aptr++; bptr++; printf("0x%p 0x%p \n ",aptr,bptr);//位置 if(*bptr =='\0') break; } } /*執行結果 a =H b= H 0x00407075 0x00404005 a =e b= e 0x00407076 0x00404006 a =l b= l 0x00407077 0x00404007 a =l b= l 0x00407078 0x00404008 a =o b= o 0x00407079 0x00404009 a = b= 0x0040707A 0x0040400A a =w b= w 0x0040707B 0x0040400B a =o b= o 0x0040707C 0x0040400C a =r b= r 0x0040707D 0x0040400D a =l b= l 0x0040707E 0x0040400E a =d b= d 0x0040707F 0x0040400F */ ```
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up