C
C
churchhela2021-10-03 22:03:23
C++ / C#
churchhela, 2021-10-03 22:03:23

What needs to be done so that the jupyterlab compiler can compile the code?

#include <stdio.h>
#include <stdlib.h>
int fib(void);
int main(void){
int k[1000];    
    for(int i=0;i<1000;i++){
    k[i] = int fib(void);
        printf("%d \n", k[i]);
    }
    return 0;
}
int fib(void){
 int a;
    int k[32768];   
    k[1]=1;
    k[2]=1;
    for(int i = 3;i<32768;i++){
    k[i]=k[i-1]+k[i-2];
    }
    a=rand();
    return k[a];
}
is the code itself.
And here is what it gives:
fib.c:7:12: error: expected expression before 'int'
                                                                                                    k[i] = int fib(void);
                                                                                                            ^~~

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vasily Bannikov, 2021-10-03
@vabka

You need to fix the syntax error on the specified line.
Tk here it is:
k[i] = int fib(void);
Not correct.
PS: just remove int and void on line 7

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question