Thread: storage class errors

  1. #1
    Registered User
    Join Date
    Jan 2011
    Posts
    113

    storage class errors

    I've a quite a few functions in my project. so made a header file
    Code:
    #ifndef _check_H
    #define _check_H
    
    int BruteForceAlgo (void)
    int check (int i, int j, int n);
    int check_row (int i, int j, int n);
    int check_column (int i, int j, int n);
    int check_box_9x9 (int i, int j, int n);
    int check_box_6x6 (int i, int j, int n);
    int output (void);
    
    #endif //_check_H
    and my main.c file looks like this..
    Code:
    # include <stdio.h>
    # include "check.h"
    
    # define size 9 //array size
    # define nmax 10 // max number in array [ 10 for 9x9, 7 for 6x6 ]
    
    //global declaration
    extern int sudoku[size][size];
    extern int TempArr[size][size];
    extern int I, J, N;
    extern int dyN;
         
    int main(void)
    {
       int i,j;
    
       // Input 
       printf("Enter Sudoku\n");
       for (i=0; i<size; i++)
       {
           for (j=0; j<size; j++) 
           {
                scanf("%d",&sudoku[i][j]);
                //copy to TempArr
                TempArr[i][j] = sudoku[i][j];
    ...............
    I've even specified # include "check.h" in function all function files...

    - As I require scope of some identifiers in other function files, I mentioned extern

    This problem is I'm getting the following errors:
    PHP Code:
    storage class specified for parameter `sudoku' 
    storage class specified for parameter 
    `TempArr
    storage class specified for parameter `I' 
    storage class specified for parameter `J' 
    storage class specified for parameter 
    `N
    storage class specified for parameter `dyN' 

    syntax error before '{' token 
    [Build Error]  [main.oError 1 
    Atleast I had idea about 'storage class' errors but I couldn't understand the last two errors..

    I don't know why "syntax error before '{' token " is coming ...

    help me.

    I'm currently using Windows XP with Dev-C++ IDE

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Based on your error messages, I believe that the errors are in code that you did not show. You probably have one or more functions where you used extern in the parameter list. Remove those uses of extern.

    By last two errors you probably mean:
    Code:
    syntax error before '{' token 
    [Build Error]  [main.o] Error 1
    The first line is an error message, the second line is just an IDE generated notification that the build failed. The error message itself is self-explanatory: there was a syntax error before the '{' token.

    Also, note that your error messages probably have line numbers that you removed when posting.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    > int BruteForceAlgo (void)
    Missing ;
    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.

  4. #4
    Registered User
    Join Date
    Jan 2011
    Posts
    113

    syntax error

    I could resolve all other errors.. but not this..
    22 D:\Dev-Cpp\sudoku\main.c syntax error before '{' token

    I am not able to understand where the error is exactly above {

  5. #5
    Registered User
    Join Date
    Jan 2011
    Posts
    113

    main file

    this is my main file..

    Code:
    # include <stdio.h>
    # include "check.h"
    
    # define size 9 //array size
    # define nmax 10 // max number in array [ 10 for 9x9, 7 for 6x6 ]
    
    // global variables.
       int sudoku[size][size];
       int TempArr[size][size];
       int I, J, N;
       int dyN;
       
    int main(void)
    {
       int i,j;
       // Input 
       printf("Enter Sudoku\n");
       for (i=0; i<size; i++)
       {
           for (j=0; j<size; j++) 
           {
                scanf("%d",&sudoku[i][j]);
                //copy to TempArr
                TempArr[i][j] = sudoku[i][j];
           }    
       }
       printf("Thanks for entering\n");
    
       BruteForceAlgo();     
       output();
       
       system ("pause");
       return 0;
    }// main

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. storage class specifier
    By -EquinoX- in forum C Programming
    Replies: 5
    Last Post: 11-06-2008, 04:07 PM
  2. Dynamic storage class?
    By Xinok in forum C++ Programming
    Replies: 12
    Last Post: 12-20-2005, 01:14 PM
  3. storage class specified for parameter
    By mart_man00 in forum C Programming
    Replies: 2
    Last Post: 06-01-2003, 02:44 PM
  4. Storage Class
    By Blanket in forum C++ Programming
    Replies: 5
    Last Post: 04-15-2003, 09:54 PM
  5. True Errors in Memory and Storage
    By Procyon in forum A Brief History of Cprogramming.com
    Replies: 3
    Last Post: 02-07-2002, 07:31 AM

Tags for this Thread