ahamed101 40 Junior Poster

Hi there,

Please try to be more specific about your queries... Looks like this is a doubly linked list... a queue?...

Like Sci@phy said, if h is a pointer to first node, you should use

if(h == NULL)

or if it is an argument you have passed to this function of type NODE**, then its correct...

Further more, do a type cast while memory allocating, like

t=(NODE *)malloc(sizeof(NODE));

How many nodes are you trying to add at one go?... And are you trying to add the node in a reverse manner?

ahamed101 40 Junior Poster

Hi there...

If you are using Eclipse on Windows then read below...

For windows, you should download eclipse-cpp-ganymede-win32.zip from http://eclispe.org. This comes with a inbuilt gnu compiler (gcc etc)... If still you are not able to compile please install MiniGW from http://minigw.org... This is free gnu compiler...

Further if you have issues please post your problems...

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

How is that any different from calling fgets(buffer, sizeof buffer, stdin )

I didn't consider this fgets... This will also give the same effect... thank you... i think i will use fgets rather than the former one... this will optimize the code...

ahamed101 40 Junior Poster

Got the answer,

char buffer[81];
int ch;
for(int i = 0; (i < 80) && ((ch = getchar()) != EOF) && (ch != '\n'); i++ )
      buffer[i] = (char)ch;
buffer[i] = '\0';
printf( "Input was: %s\n", buffer );

The above code will work.

Regards, Ahamed

ahamed101 40 Junior Poster

Hello Every Buddy.. My Problem is solved..

I was unable to send data from my C program for that I hav to make some small changes in My Serial cable.. I had make it NULL MODEM...

Just Short 4-6 and 7-6 pin

It will start sending as receiving...

Hey can you please tell me how you figured it out...

Regards,
Ahamed.

ahamed101 40 Junior Poster

Hi everyone,

Need a small help.

I need to read the data from stdin (standard input) without hitting enter. Need to read the data as in and when they are typed in until EOF (CTRL + D as I am using UNIX) is encountered.

I tried,

getc() - requires ENTER to be hit
getchar() - requires ENTER to be hit
getch() - not available in UNIX

Any suggestions would be of great help.

Thank You,
Regards,
Ahamed.

ahamed101 40 Junior Poster

conio.h is not supported in Unix C. Are you using Unix C?
You must be using conio.h probably for getch() I guess, if so you may use getchar().

ahamed101 40 Junior Poster

Guys guys... this ain't a homework solving forum... come on... are you stuck with some coding part?, then we will help you, gladly... but don;t expect us to do your homework... the algorithm you need to solve your problem is given by Salem... so please... put in some effort...

ahamed101 40 Junior Poster

Hi All,
Is there any way to invoke an Window Application (for eg say calc.exe) from a Unix Server. I think we might be needing a Windows X Server running. I am not sure how to invoke an application from the unix server. Any help on this.

Regards,
Ahamed.

ahamed101 40 Junior Poster

Can you please elaborate.... I didn't get you actually...

ahamed101 40 Junior Poster

And while posting the code in the form please use the code tags so that it becomes more readable.

ahamed101 40 Junior Poster

hey, you are missing a semi-colon in

if (*ptr == ' ') spaces++;

Hope it will work now.

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
ahamed101 40 Junior Poster

Hi Just "Press Enter" after the last curly braces. you must be using vi editor. Some compilers show this as warning.