Thread: organizing text II

  1. #16
    Registered User
    Join Date
    Sep 2006
    Usually, a good try is, when you're off by one (a common error), and you have a > with a skipped over number, try changing the > to >=.

    I can't tell if that's the problem here, because your snippet of code is small and your variable names, like z, are meaningless to me.

  2. #17
    Registered User
    Join Date
    Jun 2010
    Michigan, USA
    Commenting on CheckSym from message #13
    Quote Originally Posted by yohannes View Post
    int CheckSym (char a[])
    {	int counter=0;
    	int i=0;
    	char *temp;
    	*temp = a[i];
    	while (strcmp (temp, " ") != 0){
    		counter ++;
    		*temp = a[i++];
    		return counter;
    to find the length of symbol (i.e. 10-12B-CTRL (counter = 11), 1234-22B-CTRL (counter = 13), etc)
    What is the type of temp? What is its value or to where does it point?

    So when you dereference it (*temp) where does the value you copy (a[i]) into it go? What is the type of a[i]?

    strcmp takes as parameters null-terminated strings. How does temp point to a null terminated string? Where is the terminator?

    What is the type of " "? How many characters are in the string? How much memory does that string occupy? How much of that does strcmp look at?

    If you answer these questions for yourself, you will find a significant improvement.

  3. #18
    Registered User yohannes's Avatar
    Join Date
    Jun 2010

    thank you so much!

    Hi pheininger and especially Adak!! Thank you so much! With your help, I can finish it! kudos for you two! really want to see you and learn more from you soon!

    I want to continue my study to Master degree as soon as I finish my bachelor degree in Electrical Engineering. Do you have any idea of university in US which is awesome in Computer Engineering? I'd like to get a scholarship there, too. for I'm not rich enough to fund my study... thanks before for the info guys...

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Detect OS version
    By linucksrox in forum Windows Programming
    Replies: 4
    Last Post: 05-18-2010, 06:47 AM
  2. Replies: 8
    Last Post: 05-05-2010, 02:43 PM
  3. RichEditCtrl & unicode formatted text
    By ddonate in forum Windows Programming
    Replies: 0
    Last Post: 03-26-2010, 10:50 AM
  4. Scrolling The Text
    By GaPe in forum C Programming
    Replies: 3
    Last Post: 07-14-2002, 04:33 PM
  5. Replies: 1
    Last Post: 07-13-2002, 05:45 PM

Tags for this Thread