-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathjc.c
48 lines (37 loc) · 890 Bytes
/
jc.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include <stdio.h>
#include "Python.h"
#include "jc.h"
//In most cases, the easiest way to deal with this problem is to rewrite your C source
//to use Pythonic methods, e.g. PySys_WriteStdout:
//https://github.com/ipython/ipython/issues/1230
#define printf PySys_WriteStdout
// In C int foo() and int foo(void) are different functions.
// http://stackoverflow.com/questions/42125/function-declaration-isnt-a-prototype
int prt( void)
{
printf( "Hello\n");
return 0;
}
int prt_str( char* str)
{
printf( "%s\n", str);
return 0;
}
unsigned int bin_sum( unsigned int a, unsigned int b)
{
unsigned int c;
c = a + b;
return c;
}
int sumup( int N) {
int s = 0;
int ii, jj, kk;
for( ii = 0; ii < N; ii++) {
for( jj = 0; jj < N; jj++) {
for( kk = 0; kk < N; kk++) {
s += ii * jj * kk;
}
}
}
return s;
}