Thread: sily mistake...cant find it!

  1. #1
    Registered User
    Join Date
    Aug 2010
    Posts
    230

    sily mistake...cant find it!

    whats wrong?
    Code:
    ...
    			fflush(stdout);
    			exit(0);
    	}
    	printf("this line should never be printed\n");
    } /* end of main */
    
    long unsigned int yourfunction(unsigned int n){
    	/* fopen example */
    	FILE *pFile;
    	pFile = fopen ("myfile.txt","w");
    		if (pFile != NULL){
    			fputs ("fopen example\n", pFile);
    			fclose (pFile);
    		}else{
    			exit(1);
    		}
    		
    return 0;
    }
    output:
    Code:
    cs091770@csroot:~/Desktop$ gcc kernel_system.c 
    kernel_system.c: In function ‘main’:
    kernel_system.c:296: error: expected declaration or statement at end of input

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    Given the poor quality of your indentation, I'd say the problem was a lot earlier in your code.

    Basically, you have an extra / missing brace somewhere, but that doesn't seem to be in the snippet you posted.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User
    Join Date
    Aug 2010
    Posts
    230
    ok salem i will check out the whole code then...thanks !

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Problem building Quake source
    By Silvercord in forum Game Programming
    Replies: 16
    Last Post: 07-11-2010, 09:13 AM
  2. How to find O of threads ?
    By jabka in forum C Programming
    Replies: 3
    Last Post: 03-11-2008, 12:25 PM
  3. Please help! - Who find mistake in the program??
    By nivek in forum C++ Programming
    Replies: 4
    Last Post: 01-06-2008, 01:28 AM
  4. how do u find 2nd largest number??
    By juancardenas in forum C Programming
    Replies: 8
    Last Post: 02-14-2003, 08:28 AM
  5. Q: Recursion to find all paths of a maze
    By reti in forum C Programming
    Replies: 7
    Last Post: 11-26-2002, 09:28 AM