[gull] Types : [was: Php/MsSQL obsoletes?]

Marc SCHAEFER schaefer at alphanet.ch
Thu Sep 29 08:54:15 CEST 2005


On Wed, Sep 28, 2005 at 11:00:57PM +0200, JM Nunes wrote:
> *************** en C ****************
> main () {
> char* x = "123";
>   printf ("x=%i"; x);
> }
> ************
> compilé et exécuté résulte en:
> ./a.out
> x=134513860

sans retirer à cette démonstration intéressante:

schaefer at voyager:/tmp$ gcc -Wall a.c
a.c:1: warning: return type defaults to `int'
a.c: In function `main':
a.c:4: warning: implicit declaration of function `printf'
a.c:4: warning: int format, pointer arg (arg 2)
a.c:5: warning: control reaches end of non-void function

correction de la source:

#include <stdio.h>

int main() {
	   char *x = "123";
	   
	   printf("x=%i\n", x);

	   return 0;
}

schaefer at voyager:/tmp$ gcc -Wall a.c
a.c: In function `main':
a.c:6: warning: int format, pointer arg (arg 2)

ok, ce n'est qu'un warning, d'accord.




More information about the gull mailing list