FuncA was not declared in this scope C programming Error -


i'm new in c programming , i'm trying learn language. when compile code made show error "funca not declared in scope". try declared function below.

 #include<stdio.h>   int main(){         int = 1;       funca(a);       printf("%d\n");       }   int funca(int b){       b++;             return b++;  } 

sorry question.

you need put declaration:

int funca(int b); 

before main().

alternatively, can move main() after function definition.


p.s.: @jonathanleffler commented, printf("%d\n") undefined behavior:

if argument not type expected corresponding conversion specifier, or if there less arguments required format, behavior undefined. if there more arguments required format, extraneous arguments evaluated , ignored.

you want this:

printf("%d\n", funca(a)); 

Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -