Thread: cant compile this code and also treid of finding errors

  1. #1
    Registered User
    Join Date
    Aug 2013
    Posts
    1

    Exclamation cant compile this code and also treid of finding errors

    i wrote this code to blink 8 leds! but its not working! can anyone define me why? HELP

    Code:
    #include<stdio.h>
    #include<time.h>
    
    
    
    
         const int DELAY_TIME = 1;
         const int RUNNING_TIME = 30;
         int main() {
    
    
         long long int start = time(NULL);
         long long int MWANZO = time(NULL);
         int timer = DELAY_TIME;
    
    
         while((time(NULL)-MWANZO)<RUNNING_TIME){
         int K, L;
         for(K=1; K<=8; K++){
             do {
                if(timer == DELAY_TIME) {
                    timer = 0;
                    start = timer(NULL);
    
    
                    for(L=1; L<=8; L++){
                        if(L==K) printf("\t0");
                        else printf("\t.");
                        }
                        printf("\n\n")
                }else{
                timer = time(NULL) - start;
                }
             } while(timer != DELAY_TIME);
         }
    
    
    
    
         }
    
    
    }
    Last edited by prit19; 08-26-2013 at 01:00 AM.

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    38,657
    Code:
    $ gcc -Wall -Wextra baz.c
    baz.c: In function ‘main’:
    baz.c:23:30: error: called object ‘timer’ is not a function
    baz.c:31:13: error: expected ‘;’ before ‘}’ token
    baz.c:43:1: warning: control reaches end of non-void function [-Wreturn-type]
    They seem fairly self explanatory to me.

    >baz.c:23:30: error: called object ‘timer’ is not a function
    time() is a function
    timer is a variable
    Trying to call timer() is wrong - consider your spelling perhaps.

    > baz.c:31:13: error: expected ‘;’ before ‘}’ token
    A good place to look would be for a missing ; on line 30
    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.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. need help with finding errors
    By tosihiro2007 in forum C Programming
    Replies: 3
    Last Post: 04-17-2013, 06:43 AM
  2. Help me finding the errors PLEASE !!!
    By Salmi in forum C++ Programming
    Replies: 6
    Last Post: 01-28-2010, 02:49 AM
  3. Compile Errors in my Code. Can anyone help?
    By DGLaurynP in forum C Programming
    Replies: 1
    Last Post: 10-06-2008, 09:36 AM
  4. Visual Studio 2005 - Debug code with compile errors?
    By Swerve in forum A Brief History of Cprogramming.com
    Replies: 2
    Last Post: 03-17-2008, 08:12 AM
  5. compile errors
    By spider in forum C++ Programming
    Replies: 4
    Last Post: 12-11-2001, 08:43 AM