I did the following exercise as it appears in a book:
/*4_3.c en prueba*/
#include<stdio.h>
int k=5; /*variable global*/
void main(void){
void f1(void); /*prototipo de función*/
int i;
for(i=1;i<=3;i++){
f1();
}
}
void f1(void){
int k=2 /*variable local*/
k+=k;
printf("\n\nEl valor de la variable local es: %d", k);
::k = ::k + k;
printf("\nEl valor de la variable global es: %d", ::k);
}
and I was supposed to get a program like this more or less:
but when compiling I get an error, I'm using in cmd:
gcc -o test 4_3.c
Does anyone know what can happen? because I copied the example just like in the book.