我寫了這個程序爲學校的錯誤的工作,但是我不斷收到C++相關的錯誤(顯然)C程序不涉及到C++
#include <stdio.h>
#define int NUM_OF_CHARS 51
void switch (char *c)
{
//Little Letters
if (((*c)>=97) && ((*c)<=122))
(*c)-=32;
//Capital Letters
if ((c>=65) && (c<=90))
(*c)+=32;
//*c>=5
if ((c>=53) && (c<=57))
(*c)=56;
//*c<5
if ((c>=48) && (c<=52))
(*c)=48;
}*/
int main() {
char string[51];
printf("PLease Enter a String \n");
scanf("%s", string);
printf("%s => ", string);
int i=0;
char s[51];
while((string[i]!= "\0") && (i < NUM_OF_CHARS))
{
s[i]=switch (string[i]);
i++;
}
printf("%s", s);
return 0;*/
}
我越來越方案和宏的名稱,如/雜散XXX錯誤必須確定。
我對C很陌生,所以如果你能指出我在這段代碼中的錯誤是什麼,我會很感激。謝謝!!
你使用c編譯器還是C++編譯器? – user463035818
我正在使用C lion – tamir
'#define int NUM_OF_CHARS 51'應該是'#define NUM_OF_CHARS 51' – George