Help with code, I can't seem to fix the error

This is a discussion on Help with code, I can't seem to fix the error within the C Programming forums, part of the General Programming Boards category; These are the errors I am getting. test.c:17: error: expected ‘)’ before ‘[’ token test.c: In function ‘main’: test.c:28: warning: ...

  1. #1
    Registered User
    Join Date
    Oct 2008
    Posts
    15

    Help with code, I can't seem to fix the error

    These are the errors I am getting.
    test.c:17: error: expected ‘)’ before ‘[’ token
    test.c: In function ‘main’:
    test.c:28: warning: unused variable ‘arrZ’
    test.c: At top level:
    test.c:122: error: expected ‘)’ before ‘[’ token


    Here is my code:
    Code:
    //includes
    #include <stdio.h>
    #include <math.h>
    
    //Macros:
    #define SIZE  20
    #define SENTINEL -99
    
    
    
    
    //function prototypes
    int countElementsX ( const double arrX[] );
    int countElementsY ( const double arrY[] );
    void multiplyArrays( const double arrx [], const double arry[], double arrz [], int n);
    void printArrays(arrX[], arrY[], arrZ[]);
    void root (double arrZ[] );
    
    int main( void )
    
    {
    
    	//variables in my  functions.
    	//double arrays x and y, z all have 20 elements, and should each be initialized to have 0 in each element
    	double arrX[SIZE] = {0};
    	double arrY[SIZE] = {0};
    	double arrZ[SIZE] = {0};
    	int m,n;  //will be the real number of elements in the arrays
    	int i; //counting variable
    
    		//Get the input from the user for array X:
    
    
    	printf("please input at most %d numbers separated by blanks.  Make the last number in your list %d> ", (SIZE-1), SENTINEL);
    	
    	
    	for (i = 0; i< SIZE; ++i)
    	scanf("%lf", &arrX[i]);
    
    		//Get input from the user for array Y:
    
    	printf("Again, please input your second list of at most %d numbers separated by blanks.Make the last number in your list %d> ", (SIZE-1), SENTINEL);
    	
    	
    	for (i = 0; i< SIZE; ++i)
    	scanf("%lf", &arrX[i]);
    
    
    		
    	n= countElementsX (arrX);
    	printf("The first array has %d elements", n);

  2. #2
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,185
    Code:
    void printArrays(arrX[], arrY[], arrZ[]);
    You need types here.

  3. #3
    Registered User
    Join Date
    Oct 2008
    Posts
    15

    thanks

    I found that. now, I am having other problems! joy...

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Another syntax error
    By caldeira in forum C Programming
    Replies: 31
    Last Post: 09-05-2008, 02:01 AM
  2. Errors including <windows.h>
    By jw232 in forum Windows Programming
    Replies: 4
    Last Post: 07-29-2008, 02:29 PM
  3. Getting other processes class names
    By Hawkin in forum Windows Programming
    Replies: 3
    Last Post: 03-20-2008, 05:02 PM
  4. using c++ in c code
    By hannibar in forum C Programming
    Replies: 17
    Last Post: 10-28-2005, 10:09 PM
  5. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 07:39 AM

Tags for this Thread


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