我開始學習C中的指針。如何修復C中的指針錯誤?
如何解決我在函數x()
中的錯誤?
這是錯誤:
Error: a value of type "char" cannot be assigned to an entity of type "char *".
這是完整的源:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
void x(char **d, char s[]) {
d = s[0]; // here i have the problem
}
void main() {
char *p = NULL;
x(&p, "abc");
}
這個問題不斷變化,以微妙的方式,使評論不再相當準確了。 –
您最近編輯的程序沒有錯誤,只是一個警告。如果你打算使用'p',它確實有一個bug。 – Brian
現在更改示例源代碼最多4個編輯。這是一個移動的目標! – EkoostikMartin