ahamed101 40 Junior Poster
Narue commented: Can't you just let threads die peacefully? -4
ahamed101 40 Junior Poster

This thread is stupid.
ahamed101 -- save the data in files and fopen them according to the input parameters of the program.
OR do what you were doing with the #include and just live with code reuse.

I believe no questions are stupid. Please refrain from making such comments in the future.

Ancient Dragon commented: I agree +25
ahamed101 40 Junior Poster

@gerard4143 : I can't use dlls, I have a restriction.
@Dave : The first example is working, the structure gets populated with values in the inc file.

Thanks for the replies.

Ok, if its not possible then is there any other way to populate this structure using the inc files without using #include?

ahamed101 40 Junior Poster

What is your problem anyways... No clue... seriously... one thing we know, you got a problem for sure... be more specific buddy...

Aia commented: lame comment -2
ahamed101 40 Junior Poster

Yes that helps...

int main(int argc, char **argv)
{
	int i;
	int n = 3;
	int sum = 1;
	int total = 0;

	for(i=1; i<n; i++)
	{
		sum = sum + 3;
		total = total+sum;
	}
	total++;/* To take care of 1 */
	printf("\n Total %d",total);
	getchar();
	return 0;
}

Let me know if its work...

WaltP commented: Solving someone's homework for them -3
ahamed101 40 Junior Poster

Hi there,

for (i=0;i<=2;i++){
		fflush(stdin);
			scanf("%d %c %c %c %d",&d2[i].roll,&d2[i].name,&d2[i].dep,&d2[i].course,&d2[i].year);
		}

Just add fflush(stdin) inside the for loop... this will solve your problem...
To remember : Always use fflush(stdin) before scanf() cause if not done, the input which you have given will remain in the input stream and it will get read by scanf next time...

Salem commented: Stop recommending fflush(stdin). It's just plain wrong. -4
ahamed101 40 Junior Poster

Here it is...

#include "stdio.h"
#include "conio.h"
int fact (int n); // function prototype//

int main (void)
{
	int n,result;

	printf("please enter a positive integer");
	scanf("%d", &n);

	result = fact(n);

	printf("The answer is %d\n", result);

	getch();
	return 0;
}

int fact (int n)
{
	   if (n<=1)
		   return 1;
	   else
		   return(n*fact(n-1));
}
ssharish2005 commented: Point the mistake the OP did rather. Dont do his work! +0
ahamed101 40 Junior Poster

You learn C, you will master 70% of programming languages. I have attached a C tutorial pdf for getting started. Hope it will be helpful. I strongly recommend to try out the programs and not just reading through. You may download Dev-cpp from bloodshed.net for an C IDE. All the best.

Salem commented: For posting copyrighted material. -4