main function?
main.c?
printf function? Why do you need to do this?
printf function?
stdio.h?
#include<stdio.h>?
printf
function (the more possibilities you name, the better)?
a>b?a:b; ?
creall function?
cimagl
function?
complex.h, do you
need to link your program with -lm option?
while(condition)body
using the for loop.
for(init;cond;inc)body
using the while loop.
do body while(condition);
using the for loop.
void do_something_with_an_array(int a[]); –
is it the copy of the whole rray that is passed, or only a copy of the pointer
to the first element of the array?
int a[] = {0,1,2,3,4};
int b[5];
int n = (double)rand()/RAND_MAX*10+1;
int c[n];
int *d=(int*)malloc(n*sizeof(int));
void stat(){
double a[500];
}
void vla(size_t n){
double a[n];
}
void mal(){
double* a=(double*)malloc(500*sizeof(double));
}
void maf(){
double* a=(double*)malloc(500*sizeof(double));
free(a);
}
double* mar(){
double* a=(double*)malloc(500*sizeof(double));
return a;
}
struct vector {double x,y,z;};
struct vector v = {1,2,3};
struct vector x = {1,2,3};
struct vector v = [1,2,3];
struct vector u = {.x=1,.y=2,.z=3};
struct vector w = {.z=3,.y=2,.x=1};
vector y;
typedef struct vector vector;
vector z;
main function?
int main(int argc, char* argv[]) { /* do stuff */ }
main function into
double or int number?
CC,
CFLAGS,
CXXFLAGS,
CPPFLAGS,
LDFLAGS,
LDLIBS.
main.c.
Which of the following makefiles will compile and link the
program into the executable file main?
all: main
main: main.c
main: main.o
all: main
main: main.o
main.o: main.c
all: main
main.o: main.c
main: main.o
main.o: main.c
all: main
main: main.o
main: main.c
cc main.c -o main
main: main.c
$(CC) $(CFLAGS) $(LDFLAGS) $^ $(LDLIBS) -o $@
all: main
main: main.o
cc main.o -o main
main.o: main.c
cc -c main.c -o main.o
main function,
contained in the file main.c, calls the functions
foo and
bar
which are contained correspondingly in the files
foo.c and
bar.c.
Which of the following makefiles will correctly compile and link your
program into the executable file main after the command
make?
main: main.o foo.o bar.o
main: foo.o main.o bar.o
main: foo.o main.o bar.o
cc foo.o main.o bar.o -o main
main: main.o foo.o bar.o
$(CC) $(LDFLAGS) $^ $(LDLIBS) -o $@
main: main.o foo.o bar.o
main.o: main.c
foo.o: foo.c
cc -c $^ -o $@
bar.o: bar.c
main: main.o foo.o bar.o
cc main.o foo.o bar.o -lm -o main
main.o: main.c
cc -c main.c
foo.o: foo.c
cc -c foo.c
bar.o: bar.c
cc -c bar.c
obj = main.o foo.o bar.o
main: $(obj)
#define PI 3.1415927
what is the effect of it?
double k=0;
void foo(double x){ printf( "k*x= %g\n", k*x); }
int main(void) {
k=1; foo(1);
k=2; foo(1);
k=3; foo(1);
return 0;}
double k=0;
void foo(double x){ printf( "k*x= %g\n", k*x); }
int main(void) {
double k=0;
void foo(double x){ printf( "k*x= %g\n", 500*k*x); }
k=1; foo(1);
k=2; foo(1);
k=3; foo(1);
return 0;}
gsl_odeiv2_system?
gsl_multiroot_function and read the declaration.