sily mistake...cant find it!

This is a discussion on sily mistake...cant find it! within the C Programming forums, part of the General Programming Boards category; whats wrong? Code: ... fflush(stdout); exit(0); } printf("this line should never be printed\n"); } /* end of main */ long ...

  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
    32,855
    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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  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, 10:13 AM
  2. How to find O of threads ?
    By jabka in forum C Programming
    Replies: 3
    Last Post: 03-11-2008, 01: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

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