help with strange problem

This is a discussion on help with strange problem within the C Programming forums, part of the General Programming Boards category; Hello. I've written a small program with c using dev-c++ yesterday and it was working proper so i know there ...

  1. #1
    Registered User
    Join Date
    Sep 2006
    Posts
    13

    Question help with strange problem

    Hello. I've written a small program with c using dev-c++ yesterday and it was working proper so i know there is no problem about the code. I've finished it and turned off my pc. When I run it today, it ran and did what i've told it to do, but I recieved an error message from windows saying the program needs to be shut in stead of program "returning 0". Please help if you know what causes this. Thanks.

  2. #2
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Your code is messed up some place, and you lucked out yesterday.


    Quzah.
    Hope is the first step on the road to disappointment.

  3. #3
    Registered User
    Join Date
    Sep 2006
    Posts
    13
    i think this is the troubled loop:
    Code:
    while(j<size){
                       i=j;
                          while(i>0){
                                  if(!strcmp(array[j],array[j-i])){
                                                                     j++;
                                                                     i=j;
                                                                     continue;
                                                                     } 
                                  i--;
                                  }
    }
    i and j are defined 0 at the beginning. It is supposed to continue to the next part if the given strings are not the same.can you see what is wrong with it?
    Last edited by creon; 09-13-2006 at 05:17 AM.

  4. #4
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Is 'array' a two dimensional array, or an array of pointers to character? Or is it just a simple array of characters? If the latter, you're probably using it wrong.

    State what it is you're trying to do, and we'll suggest a few ways to go about it.


    Quzah.
    Hope is the first step on the road to disappointment.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Strange problem with GETLINE
    By wco5002 in forum C++ Programming
    Replies: 13
    Last Post: 07-07-2008, 09:57 AM
  2. Strange problem
    By G4B3 in forum C Programming
    Replies: 6
    Last Post: 05-14-2008, 02:07 PM
  3. Strange problem with classes in header files
    By samGwilliam in forum C++ Programming
    Replies: 2
    Last Post: 02-29-2008, 03:55 AM
  4. Strange problem
    By ~Kyo~ in forum Game Programming
    Replies: 0
    Last Post: 02-14-2006, 09:35 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21