我得到印错字母,当我运行这样的功能:在功能设置指针
#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