segmentation fault

ive written my code in C for implementation of a simple lexical analyser using singly linked list hence am making use of dynamic allocation,but when run in linux it gives a segmentation fault is it cause of the malloc function that ive made use of????any suggestions as to what i could do???
thank you!!

I can't tell what your problem is from here.
The first problem is to find where in your code the segfault occurs -
compile and run your code under a debugger (gdb)

gcc -g -o myfile myfile.c
gdb myfile
gdb > r  <command line arguments>
<segfault happens here>
ba

The ba command in gdb will show a stack trace. Please post it.

Ya will do that & get back to you...
thanks

rockgal, please review the rules:

(9) Edit your posts if you see spelling or grammar errors (don't write in cyberchat or cyberpunk style). English only.

I tried out these commands gdb >r <myfile> & gdb bt <myfile> on fedora 4.0
and this is what i got
bash: syntax error near unexpected token 'newline'
Am not sure of the syntax of the command but i picked up 'bt' from the man pages. I did try all possibilities and this is what i got for all of them...!
Please let me know if my command syntax is wrong or thats the error in my program and how can i debug it???
thank you,
rockgal

refers to gdb prompt typing r + optional command-lines
Seems like you are typing this in bash "gdb >r <myfile> & gdb bt <myfile>"

Crashing in linux, as in, doesn't crash in windows?

Windows lets you get away with a lot of stupid stuff sometimes, but only temporarily. Instead of crashing immediately as Linux does, it silently corrupts the heap, causing inexplicable errors in the future in code that has nothing to do with whatever your code did wrong.

It's frustrating, I know. It's only when I moved to linux did I find out how bad some of my code was!

P.S: "U" is not a word!

No it does'nt crash in windows,
i did try gcc with the -g option only and it worked,
and i did get to know where my segmentation fault happens there was no stack...do i post the the gcc -g myfile output here???

Yes. Posting your code wouldn't hurt either.