Zach wrote:
#include <stdio.h>
#include <math.h>
int i=0, j=0, *z=0;
double tanjent=0.0;
1> void main(int *)
{
for(;;)
{
2> tanjent[&z] = sin(i) / cos (j);
3> *z=&z+1
}
4> printf(tanjent[k],"%d);
5> return &z;
}
1> main returns int, and has parameters of type int and char**
2> attempt to index NULL, doomed.
2> sin(0) / cos(0) == 0 / 1 == 0
3> attempt to store a pointer in an int. No final semi.
4> Bad arguments to printf, and unterminated string. k undeclared.
5> returning a pointer in place of an int.
The "for(;;)" line is correct, as are the isolated braces. So I
would say it falls a tad short of perfection. Your compiler should
have showed these up.
[1] c:\c\junk>cc junk.c
junk.c:8: warning: return type of `main' is not `int'
junk.c:8: warning: first argument of `main' should be `int'
junk.c:8: warning: `main' takes only zero or two arguments
junk.c: In function `main':
junk.c:7: parameter name omitted
junk.c:11: subscripted value is neither array nor pointer
junk.c:13: warning: assignment makes integer from pointer without a
cast
junk.c:13: parse error before '}' token
junk.c:14:21: warning: multi-line string literals are deprecated
junk.c:14:21: missing terminating " character
junk.c:14:21: possible start of unterminated string literal
--
"If you want to post a followup via groups.google.c om, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers." - Keith Thompson