@Sachin :thanks man i just tried to change the code with focus on initializing NULL values to child pointers array (TrieNode->symbol in this case) and it just works fine.
@Atul : thank you for trying to run the code. Actually the IDE i use preferably is DEV-c++ which had the problem i mentioned. But if i try to compile it on Linux with g++ it doesnt give any error message. --