URL: https://linuxfr.org/forums/programmation-c--2/posts/fonction-et-pointeurs Title: Fonction et pointeurs Authors: 1984 Date: 2017年10月07日T08:07:25+02:00 License: CC By-SA Tags: Score: 0 Bonjour, Le principe du code, c'est que y et x dans la fonction random() envoie des valeurs aléatoires à la fonction print(), et print() affiche les résultats. ```C #include #include void random(int *y, int *x){ srand((int)time(NULL)); *y = rand()% (50-1) + 1; *x = rand()% (100-1) + 1; } void print(int a, int b){ random(&a,&b); printf("x:%d,y:%d\n",a,b); } int main(){ random(); print(); return 0; } ``` gcc envoie ce résultat :>random.c: In function ‘main’: random.c:15:5: error: too few arguments to function ‘random’ random(); ^ random.c:4:6: note: declared here void random(int *y, int *x){ ^ random.c:16:5: error: too few arguments to function ‘print’ print(); ^ random.c:9:6: note: declared here void print(int a, int b){ Quelqu'un aurait une idée ? Je ne suis pas spécialement bon avec les pointeurs.

AltStyle によって変換されたページ (->オリジナル) /