edited by
806 views
1 votes
1 votes
#include <stdio.h> 
void demo() 
{ 
	printf("GeeksQuiz "); 
} 
int main() 
{ 
demo();
	return 0; 
}
******************************************************************************
#include <stdio.h> 

int main() 
{ 
demo();
	return 0; 
}

void demo() 
{ 
	printf("GeeksQuiz "); 

} 

 

will both program same  result?

 

edited by

2 Answers

0 votes
0 votes
yes both are same,

it start the execuation o main function
0 votes
0 votes

NO. 

If you want to define demo(); after main(), then you need to include the function definition before the main function, otherwise your code will result in an error.

#include <stdio.h>

void demo(); // function defination

int main() {
demo();
return 0;
}

void demo() {
printf("GeeksQuiz ");

}

 

Related questions

0 votes
0 votes
1 answer
1
saif asked Jun 2, 2018
633 views
How can we identify whether a function is call by value or call by refrence?? by looking at the defination or by looking at the statement where it is called.please someon...
2 votes
2 votes
1 answer
2
suneetha asked Aug 31, 2017
1,083 views
#include <stdio.h #include <stdarg.h int fun(int n, ...) { int i, j = 1, val = 0; va_list p; va_start(p, n); for (; j < n; ++j) { i = va_arg(p, int); val += i; } va_end(p...
1 votes
1 votes
0 answers
4
Amit puri asked Sep 22, 2016
201 views
int main(){Char *str=”Gate2017”;printf(“%d”, fun( str ));return 0;}int fun(char *P1){Char *P2=P1;while (*++P1) return (P1-P2);}The output of the above progra...