![]() ![]() ![]() | functions/functions-input-1-b.c - Samme som ovenfor - men vi forsøger at bruge i og j fra main i f. | Lektion 6 - slide 8 : 21 Program 4 |
#include <stdio.h> /* Input: Same as above, but we attempt to use i and j from main in f. The compiler spots the error. */ void f(int fp1, int fp2){ printf("fp1 + fp2 = %d + %d = %d\n", fp1, fp2, i + j); /* i and j are undeclared */ } int main(void) { int i = 3, j = 4; f(i, j); printf("i + j = %d + %d = %d\n", i, j, i + j); return 0; }