Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6727131
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T10:00:42+00:00 2026-05-26T10:00:42+00:00

This is the first time, when I’m using C. I have to do my

  • 0

This is the first time, when I’m using C. I have to do my numeric mathematics homework in C.

So I have problem using multi dimensional arrays. I don’t now why I’m getting the following errors:

  • subscripted value is neither array nor pointer nor vector
  • subscripted value is neither array nor pointer nor vector
  • In function ‘inMatrix’:
    error: subscripted value is neither array nor pointer nor vector|
  • In function ‘inVector’:|
    error: subscripted value is neither array nor pointer nor vector|
  • In function ‘outVector’:|
    error: subscripted value is neither array nor pointer nor vector|
  • In function ‘main’:|
    error: incompatible type for argument 2 of ‘plu’|
  • note: expected ‘float (*)[(long unsigned int)(k)]’ but argument is of type ‘float’|
    error: incompatible type for argument 3 of ‘plu’|
  • expected ‘float *’ but argument is of type ‘float’|

For example:
I don’t know why it is complaining about the ‘float *’ when I didn’t use a float pointer.Searching on google didn’t return any results, so I don’t know what the error is. I don’t understand this error ‘subscripted value is neither array nor pointer nor vector’.

What can I do? How can I rewrite my source code to get rid of these compiler errors?

Sorry for my poor English.

#include <stdio.h>
#include <stdlib.h>

void inMatrix(double matrix, int n)
     {
     int j, i;
        for (i = 0; i < n; i++)
        {
            for (j= 0; j < n; j++)
            {
               scanf("%lf", &matrix[i][j]);
            }
        }
     }

void inVector(double vektor, int n)
     {
     int k;
        for (k = 0; k < n; k++)
        {
            scanf("%lf", &vektor[k]);
        }
     }

void outVector(double vektor, int n)
     {
     int k;
        for (k = 0; k < n; k++)
        {
            printf("%.8lf", vektor[k]);
        }
     }

int plu(int k, float A[k][k], float b[k], float x[k])
    {
        int P[k];
        int n, m, p, i, j;
        int d=0;
        int r=0;
        int T=0;
        float t=0;
        float y[k];
        //seged vektorok
        for(n=1; n<k;n++)
        {
            x[n]=0;
            y[n]=0;
        }
        // Permutaciós matrix
        // permutation
        for(i=1; i<k; i++)
        {
            P[i]=i;
        }
        // Rendezes
        // sorting
        for(d=1; d<k-1;d++)
        {
            p=0;
            for(i=d; i<k; i++)
                {
                    t=A[i][d];
                    if(t<0)
                        t=-1*t;
                    if(t>p)
                    {
                        p=t;
                        r=i;
                    }
                }
                //Ha szingularis
                //If singular
                if(p==0)
                {
                   // printf("szingularis");
                    return 1;
                }
                //Matrix Csere
                //Matrix change
                T=P[r];
                P[r]=P[d];
                P[d]=T;

                //matrix elem csere
                //matrix value change
                for(i=1; i<k; i++)
                {
                    t=A[r][i];
                    A[r][i]=A[d][i];
                    A[d][i]=t;
                }
                for(i=d+1;i<k;i++)
                {
                    A[i][d]=A[i][d]/A[d][d];
                    for(j=d+1; j<k; j++)
                    {
                        A[i][j]=A[i][j]-A[i][d]*A[d][j];
                    }
                }
            }
            // Megoldas Vektorra
            // Solve for Vector
            for(n=1; n<k;n++)
            {
                t=0;
                for(m=1;m<=n-1;m++)
                {
                    t+=A[n][m]*y[m];
                }
                y[n]=b[P[n]]-t;
            }
            for(n=k-1;n>=1;n--)
            {
                t=0;
                for(m=n+1; m<k;m++)
                {
                    t+=A[n][m]*x[m];
                }
                x[n]=(y[n]-t)/A[n][n];
            }
        return 0;
    }

int main()
{
    //int i,j,k, num,value;
    // d as numbers of dimmension
    int d;
    // Read dimension of array
    scanf("%d", &d);

    float matrix[d][d];
    float vector[d];

    inMatrix(matrix[d][d], d);
    inVector(vector[d], d);

    float resVector[d];

    if(plu(d,matrix[d][d],vector[d], resVector[d])==1)
    {
        printf("szingularis");
    }
    else
    {
        outVector(resVector[d], d);
    }

    return 0;
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T10:00:43+00:00Added an answer on May 26, 2026 at 10:00 am

    Here, I’ve fixed the compiler errors for you.
    I won’t bother to explain in detail the errors as you clearly need to read a good book first.

    #include <stdio.h>
    #include <stdlib.h>
    
    void inMatrix(int n,double matrix[n][n])
         {
         int j, i;
            for (i = 0; i < n; i++)
            {
                for (j= 0; j < n; j++)
                {
                   scanf("%lf", &matrix[i][j]);
                }
            }
         }
    
    void inVector(double vektor[], int n)
         {
         int k;
            for (k = 0; k < n; k++)
            {
                scanf("%lf", &vektor[k]);
            }
         }
    
    void outVector(double vektor[], int n)
         {
         int k;
            for (k = 0; k < n; k++)
            {
                printf("%.8lf", vektor[k]);
            }
         }
    
    int plu(int k, double A[k][k], double b[k], double x[k])
        {
            int P[k];
            int n, m, p, i, j;
            int d=0;
            int r=0;
            int T=0;
            float t=0;
            float y[k];
            //seged vektorok
            for(n=1; n<k;n++)
            {
                x[n]=0;
                y[n]=0;
            }
            // Permutaciós matrix
            // permutation
            for(i=1; i<k; i++)
            {
                P[i]=i;
            }
            // Rendezes
            // sorting
            for(d=1; d<k-1;d++)
            {
                p=0;
                for(i=d; i<k; i++)
                    {
                        t=A[i][d];
                        if(t<0)
                            t=-1*t;
                        if(t>p)
                        {
                            p=t;
                            r=i;
                        }
                    }
                    //Ha szingularis
                    //If singular
                    if(p==0)
                    {
                       // printf("szingularis");
                        return 1;
                    }
                    //Matrix Csere
                    //Matrix change
                    T=P[r];
                    P[r]=P[d];
                    P[d]=T;
    
                    //matrix elem csere
                    //matrix value change
                    for(i=1; i<k; i++)
                    {
                        t=A[r][i];
                        A[r][i]=A[d][i];
                        A[d][i]=t;
                    }
                    for(i=d+1;i<k;i++)
                    {
                        A[i][d]=A[i][d]/A[d][d];
                        for(j=d+1; j<k; j++)
                        {
                            A[i][j]=A[i][j]-A[i][d]*A[d][j];
                        }
                    }
                }
                // Megoldas Vektorra
                // Solve for Vector
                for(n=1; n<k;n++)
                {
                    t=0;
                    for(m=1;m<=n-1;m++)
                    {
                        t+=A[n][m]*y[m];
                    }
                    y[n]=b[P[n]]-t;
                }
                for(n=k-1;n>=1;n--)
                {
                    t=0;
                    for(m=n+1; m<k;m++)
                    {
                        t+=A[n][m]*x[m];
                    }
                    x[n]=(y[n]-t)/A[n][n];
                }
            return 0;
        }
    
    int main()
    {
        //int i,j,k, num,value;
        // d as numbers of dimmension
        int d;
        // Read dimension of array
        scanf("%d", &d);
    
        double matrix[d][d];
        double vector[d];
    
        inMatrix(d,matrix);
        inVector(vector, d);
    
        double resVector[d];
    
        if(plu(d,matrix,vector, resVector)==1)
        {
            printf("szingularis");
        }
        else
        {
            outVector(resVector, d);
        }
    
        return 0;
    }
    

    Your errors show that you don’t understand the basics of C at all.
    Take some time to review your concepts.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is my first time using joomla. I don't know if I'm using the
This is my first time with Web services. I have to develop web services
this is my first time posting here, I have a question which I have
This is the first time ever I'm using AJAX, and I want to do
this is my first time using StAX for parsing XML documents (still in the
I have two update panels at my ajax page. This is first time I'm
So here I have this first time app I'm working on. When I run
I am doing this first time so I need some help. I am using
I'm using PayPal sandbox for the payment gateway, this is first time I'm trying
This is my first time attempting to call an ASP.NET page method from jQuery.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.