回复 8楼 magabbc
不多说了,你先把编译器的报警去掉再说
C:\Windows\system32\cmd.exe /c (clang-cl -D_CRT_SECURE_NO_DEPRECATE -D_HAS_EXCEP
TIONS=0 -Wno-invalid-source-encoding main.c -o main.exe)
main.c(3,9) :
warning: 'NULL' macro redefined [-Wmacro-redefined]
#define NULL 0
^
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\stdio.h(120,9) :
note:
previous definition is here
#define NULL
((void *)0)
^
main.c(23,49) :
warning: format specifies type 'char *' but the argument has
type 'int *' [-Wformat]
printf(" Name: %s\n Tel: %s\n",p1->name,p1->tel);
~~
^~~~~~~
main.c(25,1) :
warning: control reaches end of non-void function
[-Wreturn-type]
}
^
main.c(44,20) :
warning: format specifies type 'char *' but the argument has
type 'int *' [-Wformat]
scanf("%s",q2->tel);
~~
^~~~~~~
%d
main.c(48,1) :
warning: control reaches end of non-void function
[-Wreturn-type]
}
^
main.c(57,76) :
warning: format specifies type 'char *' but the argument has
type 'int *' [-Wformat]
...printf("\n num:\t%d\n name:\t%s\n tel:\t%s\n",lp->num,lp->name,lp->tel);
~~
^~~~~~~
main.c(66,1) :
warning: control reaches end of non-void function
[-Wreturn-type]
}
^
main.c(79,16) :
warning: format specifies type 'char *' but the argument has
type 'char (*)[20]' [-Wformat]
scanf("%s",&p->name);
~~
^~~~~~~~
main.c(81,16) :
warning: format specifies type 'char *' but the argument has
type 'int (*)[20]' [-Wformat]
scanf("%s",&(p->tel));
~~
^~~~~~~~~
main.c(93,24) :
warning: format specifies type 'char *' but the argument has
type 'char (*)[20]' [-Wformat]
scanf("%s",&p->name);
~~
^~~~~~~~
main.c(94,46) :
warning: format specifies type 'long' but the argument has type
'int' [-Wformat]
printf("
Input %ld tel:\t",n);
~~~
^
%d
main.c(95,24) :
warning: format specifies type 'char *' but the argument has
type 'int (*)[20]' [-Wformat]
scanf("%s",&(p->tel));
~~
^~~~~~~~~
main.c(103,1) :
warning: return type of 'main' is not 'int'
[-Wmain-return-type]
void main()
^
main.c(103,1) :
note: change return type to 'int'
void main()
^~~~
int
main.c(143,13) :
error: void function 'main' should not return a value
[-Wreturn-type]
return 0;
^
~
main.c(148,5) :
warning: implicit declaration of function 'getch' is invalid in
C99 [-Wimplicit-function-declaration]
getch();
^
14 warnings and 1 error generated.
shell returned 1
Hit any key to close this window...
[
本帖最后由 longwu9t 于 2015-4-2 21:44 编辑 ]