global scope problem

i have a structure struct node
{
int element;
struct node* next;
};
in one file "tree_stack.c"
i have other file check_stack.c in which stack is implemented.This file contains the structurestruct st
{
struct node* nd;
struct st* nxt;
}
i have to use struct node in this check_stack.c file.So i have included this file in "tree_stack.c".
i have used it as extern struct node *nd.
but when i try to access a data
like curr->nd->element // produces error
where curr is
struct st* curr;

i am getting error of smth like "accessing incomplete data ".
anyone got clue??
guide me where i am wrong and how to correct it.
thanks

and in other file where i am actually implementing stack for tree operations like storing the nodes of the tree onto the stack in file name tree_stack.c .
the rudimentary file is smth like...(just modifying in your code)

So, you've removed half the code (probably including the code that has the actual problem) and the error message, and you want us to solve the problem?

As has been pointed out, there is nothing intrinsically wrong with curr->nd->element, so something else must be wrong.

What error is it showing? Are you getting a compile-time error or a runtime error?

It's not a good idea to #include C files in C files. Rename stack_check.c to stack_check.h and make sure it only has header stuff in it. Better still, merge everything into one C file, solve the problems, then you can split it back out again as necessary.

thank again for help
i have actually given the entire susceptible code which might cause problem.and believe me it that simple as i have wrote. its compile time error.
anyways i am really sorry that i dont have code now ..i will surely post it next time when i come to browse internet.any i really apologize for that.
i just included the file as .c .i know that .h is advisable.But may i know any good reason for that will create problem later on?
thanks again..

It's just a matter of using the correct labels. h files can be included anywhere; you don't need to worry about their contents and the assumption made by just about everyone will be that a .h file doesn't contain any code. #including a file that contains code will work once, but after that you'll get compiler errors (likely duplicate symbols), so it's best to stick to what works. Compile C files and #include H files.

It's like putting acid in a bottle labelled Water. Fine as long as you know that, but the moment you forget, or the moment someone else comes along looking for a drink, then you have a problem.

Because the stuff you've posted isn't complete it's impossible to work out what's really going wrong. What you need to do therefore is to strip this down to a MINIMAL but COMPLETE set of files then post the filename and COMPLETE file contents, then we stand a chance of working out what is up.

but I have no way of knowing if any of these correspond to any of the errors you're getting.

Both me and asadullah have now tried - and failed - to construct your code from the sparse descriptions you have given, so I think it's only fair now that you realise you must strip (an experimental copy of, if necessary) the program down to the bare minimum and show us exactly what is going wrong.

Also you need to post the EXACT errors, like I have done above. It's no use saying vague stuff like "error of smth like "accessing incomplete data "" and "here its showing error" - these could both mean absolutely anything and give no clue at all as to what is wrong.

and error i am getting is :
%gcc -g -o stack_check stack_check.c
In file included from stack_check.c:2:
tree_stack.c: In function `tree_display':
tree_stack.c:56: error: dereferencing pointer to incomplete type
%
now i hope i have given the complete prob of mine ..thanks for help

Try moving #include"tree_stack.c" after the struct node definition in stack_check.c.
The error occurs because the compiler doesn't know what struct node is, and that's because it hasn't been defined yet.