Thread: Please assistance, general protection mistake

  1. #1
    Registered User
    Join Date
    Aug 2004
    Posts
    66

    Please assistance, general protection mistake

    Hello, I am quiet annoyed about a mistake in my program, it marks no mistakes and no warnings, however, each time it runs, when i try to call a function, it marks a mistake that says:

    General Protection Exception
    programname.cpp 70
    programname(2) 0x2327:0x014f processor Fault

    then it marks one line of my program and it breaks the process.
    the line is marked blue, but I donīt know what it is doing wrong
    the program wonīt run after that until I compile it again, and it marks neither mistakes nor warnings,but keeps marking the mistake time after time when I try to run it.

    Please, can someone explain to me what could be wrong, if you believe I should place the code here i will.

  2. #2
    Registered User
    Join Date
    Sep 2004
    Location
    California
    Posts
    3,268
    Well since you haven't shown any code, the best I can give is a guess. Check and see if it's possible if you've overrun (or underrun) any buffers. Writing outside a buffer is the most common cause of a runtime error.

  3. #3
    Registered User
    Join Date
    Aug 2004
    Posts
    66
    this is the function:

    Code:
    void seleccion (int arr[], int a){
     int  b, menor, d, e;
    for(b=0;b<a;b++){
      menor=arr[b];
    
    	for(d=b+1 ;d<a;d++){
    	 if (menor>arr[d]){
    	  menor=arr[d];
    	  e=d;}
    	 }
    	  arr[e]=arr[b];  //this is where the mistake is marked
    
    	  arr[b]=menor;
    
    	}
     for(b=0; b<a; b++)
     printf("%d ", arr[b]);
    
     }

  4. #4
    Registered User
    Join Date
    Oct 2001
    Posts
    2,934
    > arr[e]=arr[b]; //this is where the mistake is marked
    You might want to print out the value of e here. If the preceeding if() is never true, e may be uninitialized.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. A general protection exception failure
    By louis_mine in forum C Programming
    Replies: 7
    Last Post: 11-25-2004, 02:22 AM
  2. General Protection Exception
    By s9uare in forum C++ Programming
    Replies: 1
    Last Post: 11-02-2002, 10:46 AM
  3. General Protection?
    By drdroid in forum C++ Programming
    Replies: 1
    Last Post: 08-17-2002, 10:09 AM
  4. general protection exception
    By chiw in forum C Programming
    Replies: 1
    Last Post: 08-14-2002, 09:54 AM
  5. General protection exception??
    By jonesy in forum C Programming
    Replies: 6
    Last Post: 10-10-2001, 12:34 AM