Hello, I am totally new to c programming. I need to submit my assignment on the problem statement:
Sort an array of strings and remove duplicate values from the sorted string array. The program has to be written in "C" language. Can some one please help me with the complete code? I am a novice to C programming.
Appreciate the help and thanks in advance.
c program to remove duplicates from a string array
Started by guda_rao, Aug 11 2009 10:30 PM
3 replies to this topic
#1
Posted 11 August 2009 - 10:30 PM
|
|
|
#2
Posted 11 August 2009 - 10:58 PM
We won't program it for you, that's the point of having a class in programming, to learn how to do it on your own. :)
BUT... we will help. Has your class taught you how to use arrays in C? And if so, do you know that strings are nothing more than C arrays that have a null-terminating character? That's probably the start, I would try writing some pseudocode example of what you want to get accomplished, then think about how that would be done in C.
BUT... we will help. Has your class taught you how to use arrays in C? And if so, do you know that strings are nothing more than C arrays that have a null-terminating character? That's probably the start, I would try writing some pseudocode example of what you want to get accomplished, then think about how that would be done in C.
Wow I changed my sig!
#3
Posted 12 August 2009 - 02:36 AM
Well do you know how to make an array. If they haven't taught you this then it is a pointless exercise. :confused:
What I would do though is sort the array and then all it requires is a linear scan of the array. If arr[i] = arr[i+1] then you have found a duplicate.
What I would do though is sort the array and then all it requires is a linear scan of the array. If arr[i] = arr[i+1] then you have found a duplicate.
#4
Posted 12 August 2009 - 07:00 AM
There are also some useful string functions built into C for comparing strings. That will help with both the sort and removal of duplicates.


Sign In
Create Account

Back to top









