Re: output unexpected
- From: Richard Heathfield <invalid@xxxxxxxxxxxxxxx>
- Date: Thu, 14 Sep 2006 18:11:17 +0000
Vaibhav87@xxxxxxxxx said:
i write
void main()
{
int j;
j - = 0;
printf("%d",y);
}
& i got the answer as 842.
I got several diagnostic messages from my compiler, which refused to produce
an executable program:
gcc -W -Wall -ansi -pedantic -Wformat-nonliteral -Wcast-align
-Wpointer-arith -Wbad-function-cast -Wmissing-prototypes
-Wstrict-prototypes -Wmissing-declarations -Winline -Wundef
-Wnested-externs -Wcast-qual -Wshadow -Wconversion -Wwrite-strings
-Wno-conversion -ffloat-store -O2 -g -pg -c -o foo.o foo.c
foo.c:2: warning: function declaration isn't a prototype
foo.c:2: warning: return type of `main' is not `int'
foo.c: In function `main':
foo.c:4: parse error before `='
foo.c:5: warning: implicit declaration of function `printf'
foo.c:5: `y' undeclared (first use in this function)
foo.c:5: (Each undeclared identifier is reported only once
foo.c:5: for each function it appears in.)
make: *** [foo.o] Error 1
i tried it on various computers but the
answer is same.
I'm surprised you got any compiler to produce an executable program.
pls help me
how is this answer is?
What answer were you expecting it to produce, and why?
--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at above domain (but drop the www, obviously)
.
- References:
- output unexpected
- From: Vaibhav87@xxxxxxxxx
- output unexpected
- Prev by Date: Re: output unexpected
- Next by Date: Re: exicut_file_in_c
- Previous by thread: Re: output unexpected
- Next by thread: Re: output unexpected
- Index(es):
Relevant Pages
|