English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

Why does this program print 0, not 1? Seems that it doesnt step into the function..

#include
void a(void);
int i=0;
int main(void){
a;
printf("%d",i);
return(0);
}

void a(void){
i=1;
}

2007-11-19 03:43:19 · 3 answers · asked by Sunny 1 in Computers & Internet Programming & Design

3 answers

you don't call the function a.

you write
a;

instead of
a();

2007-11-19 04:02:27 · answer #1 · answered by cruppstahl 4 · 0 0

u have force i=0 always with the statement
int i=0;

2007-11-19 03:51:54 · answer #2 · answered by tj is cool 5 · 0 1

Your initializing your variable "I" to "0" therefore its printing "0".

2007-11-19 03:49:49 · answer #3 · answered by Slick 5 · 0 1

fedest.com, questions and answers