我得到印錯字母,當我運行這樣的功能:在功能設置指針
#include <stdio.h>
void getletters(char *one, char *two) {
scanf("%c %c",&one, &two);
/* if i print one and two here, they are correct). */
}
int main(void) {
char one, two;
getinput(&one, &two);
char *pone = &one;
char *ptwo = &two;
printf("your letters are %c and %c", *pone, *ptwo); /* These are coming out as the wrong characters */
}
我有不正確的語法?我是否正確使用指針?
僅供參考這裏沒有任何東西被「返回」。你的意思是「打印」我懷疑。 – 2011-04-05 15:52:34
'getletters' /'getinput'是否與拼寫錯配? – Jon 2011-04-05 15:53:29
什麼是getinput? – 2011-04-05 15:54:24