Check this
http://www.daniweb.com/forums/thread147417.html
and
http://www.daniweb.com/forums/thread148447.html
It should help you out
Check this
http://www.daniweb.com/forums/thread147417.html
and
http://www.daniweb.com/forums/thread148447.html
It should help you out
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.
@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?
What is your problem anyways... No clue... seriously... one thing we know, you got a problem for sure... be more specific buddy...
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...
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...
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));
}
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.