C program : word frequency without string functions

Hey I know many would have solved this but can anyone help me out again please.

Question: I need write a C program to search for a given string in a file and count the no of occurences of that string in the file.
The condition is that i must not use any string functions like strlen, strcmp etc. I am sitting with this problem for hours. so please can anyone help me out with this problem.
The string and the file are passed through argument functions argc, argv.



  • How would you do it with string functions?
    And then write your own stringfunctions...

    Most string functions are easy (if not trivial) to write yourself.
    I'm in a good mood, let me give you an example:
    int strlen(char *str)
    int len = 0;
    while (*(str++))++len;
    return len;
    Next time you need help with a homework assignment, post code of your attemps, you'll have more chance of someone helping you and giving you good, relevant advice.

    Good luck.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


In this Discussion