540 views
2 votes
2 votes
#include <stdio.h>
int yellow();
int main()
{  
    int hello();
    yellow();
    printf("%d",hello());

    return 0;
}

int yellow(){ hello();    
}

int hello()
{printf("hello hello ");
return 1;
}

HERE I DECLARED THE FUNCTION hello() within my main function but its visible outside the main function also i expected this to give me a compilation error as the hello() is called inside yellow() but hello() is not inside the scope of yellow() but it compiles fine and outputs hello hello hello hello 1 ....are local delaration of functions globally scoped in C ??

1 Answer

0 votes
0 votes

it is giving  compiler error since  hello() was not initialized/declared before using. 

Related questions

0 votes
0 votes
0 answers
3
gmrishikumar asked Jan 2, 2019
856 views
#include<stdio.h>int main ( ){ int demo ( ); // What is this and what does it do? demo ( ); (*demo) ( );}int demo ( ){ printf("Morning");}
2 votes
2 votes
1 answer
4