Mullen2004
New member
בעיה ב C
אני מנסה לבנות פונקציה אשר מקבלת מערך של תווים ( מחרוזת ) ונוצרת הבעיה הבאה (פעולת התכנית אינה חשובה ): #include <stdio.h> int print(char *p,int leng); void main () { char *p = "hello"; int leng=0; int i; while(*p!='\0') { leng++; p++; } i=print(*p,leng); } int print(char *p,int leng) { int i=0; if(leng==-1) return 0; else { i=print(*p,leng-1); printf("%c",*(p+i)); return i; } } C:\Documents and Settings\Administrator\L.c(13) : warning C4047: 'function' : 'char *' differs in levels of indirection from 'char ' C:\Documents and Settings\Administrator\L.c(13) : warning C4024: 'print' : different types for formal and actual parameter 1 C:\Documents and Settings\Administrator\L.c(22) : warning C4047: 'function' : 'char *' differs in levels of indirection from 'char ' C:\Documents and Settings\Administrator\L.c(22) : warning C4024: 'print' : different types for formal and actual parameter 1 תודה לעזורים.
אני מנסה לבנות פונקציה אשר מקבלת מערך של תווים ( מחרוזת ) ונוצרת הבעיה הבאה (פעולת התכנית אינה חשובה ): #include <stdio.h> int print(char *p,int leng); void main () { char *p = "hello"; int leng=0; int i; while(*p!='\0') { leng++; p++; } i=print(*p,leng); } int print(char *p,int leng) { int i=0; if(leng==-1) return 0; else { i=print(*p,leng-1); printf("%c",*(p+i)); return i; } } C:\Documents and Settings\Administrator\L.c(13) : warning C4047: 'function' : 'char *' differs in levels of indirection from 'char ' C:\Documents and Settings\Administrator\L.c(13) : warning C4024: 'print' : different types for formal and actual parameter 1 C:\Documents and Settings\Administrator\L.c(22) : warning C4047: 'function' : 'char *' differs in levels of indirection from 'char ' C:\Documents and Settings\Administrator\L.c(22) : warning C4024: 'print' : different types for formal and actual parameter 1 תודה לעזורים.