Code for question no.--2
#include<stdio.h>
#include<conio.h>
#include<time.h>
struct test{
clock_t endwait;
void (*print_ptr)();
};
void print()
{printf("\nHello World\n");}
void wait ( int seconds )
{
struct test *g=(struct test *)malloc(sizeof(struct test));
g->endwait= clock () + seconds * CLOCKS_PER_SEC ;
while (clock() < g->endwait) {}
(g->print_ptr)=print;
(*(g->print_ptr))();
}
int main(){
int sec;
printf("Enter the time after which you want output:");
scanf("%d",&sec);
wait(sec);
getch();
return;
}
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.