I have a question about the sorting and arrays and I have to finish this for exam, but really i am a new student in C and I don't have an idea how to do this:
the question:
Assume that you have a very long string and you are assigned to count the number of occurrences of each character that exists in the string. For example, the string is
"this is supposed to be one damn long character array"
and the two output array should be
"this upoedbnamlgcry"
{2,2,2,4,9,1,2,3,4,2,1,3,5,1,1,1,1,2,1}
Can you write the function that does this?
3 Replies
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
dizar mejziniPosted Dec 28, 2014, 4:08 AM
VulpesPosted Dec 27, 2014, 12:52 PM
For example, there are 3 't's in the string and not 2 as shown in the second array.
Also not sure whether code is required in C or C#?
In C it would be:
and in C#:
The output in both cases is:
Shweta LodhaPosted Dec 27, 2014, 10:23 AM
How are you calculating 2nd array: