Solved

re string search

Posted on 1998-04-09
4
208 Views
Last Modified: 2010-04-15
out of shere time constraint I'll repost my updated querey      I need to call a function form main, my f/p is
void CountLetters(string, length, freq[], SIZE)
string is my string*, length is the size freq is an array[26] size#26
I need to be able to search through the string find the count of each letter and assign into corrospontding space in the array ie freq[0]= # of a's, freq[1] = # of b's both upper and lowers.
I need the array set up that way so I can sort it with anther array that contains the alphabet, need to be able to count the letters and put the values in the array freq
0
Comment
Question by:hkaufm2
4 Comments
 
LVL 2

Expert Comment

by:kellyjj
ID: 1258048
Are you wanting examples of how to do the letter counting? or maybe the sorting??  A little more clearity would help.  thanks
0
 

Author Comment

by:hkaufm2
ID: 1258049
Edited text of question
0
 
LVL 16

Expert Comment

by:imladris
ID: 1258050
Hasn't this been answered under "string search"? If not, how is this question different?
0
 
LVL 10

Accepted Solution

by:
rbr earned 50 total points
ID: 1258051
void Count_letters (char *string,int length,int *count,int size)
{
   int i;
   int ch;
   memset (count,0,sizeof(int)*size);

      for (i=0;i<length;i++) {
        ch=string[i];
             if (isalpha(ch) {
                  ch = tolower(ch)-'a';
           if (ch < size)
                     count [ch]++;
        }
    }
}
             
   
0

Featured Post

New! My Passport Wireless Pro Wi-Fi Mobile Storage

Portable wireless storage to offload, edit, and stream anywhere.

High-capacity, wireless mobile storage designed to accompany professional photographers and videographers in the field to easily offload, edit and stream captured photos and high-definition videos.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Directory does exist 19 144
Using unmanaged DLL from managed application 14 290
distributed computing in Python 4 114
Super Scope, DHCP 5 51
Have you thought about creating an iPhone application (app), but didn't even know where to get started? Here's how: ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Important pre-programming comments: I’ve never tri…
This is a short and sweet, but (hopefully) to the point article. There seems to be some fundamental misunderstanding about the function prototype for the "main" function in C and C++, more specifically what type this function should return. I see so…
The goal of this video is to provide viewers with basic examples to understand opening and writing to files in the C programming language.
The goal of this video is to provide viewers with basic examples to understand opening and reading files in the C programming language.

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now