I am creating an simple program in which I am using long long int
but I got compiler error. Please help me to resolve this error.
Error] conflicting types for
countTrees
I got error on this line
long long int countTrees(long long int numKeys)
Here is my code:
#include <stdio.h>
#include <math.h>
int main()
{
int t;
scanf("%d", &t);
while(t--)
{
long long int n;
scanf("%lld", &n);
long long int result = countTrees(n);
printf("%lld\n",result);
}
return 0;
}
long long int countTrees(long long int numKeys) {
if (numKeys <=1) {
return(1);
}
else {
long long int sum = 0;
long long int left,right,root;
for (root=1; root<=numKeys; root++) {
left = countTrees(root - 1);
right = countTrees(numKeys - root);
sum += left*right;
}
return(sum);
}
}