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 6385001
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T02:50:41+00:00 2026-05-25T02:50:41+00:00

I have a problem with my program. I am trying to run trough an

  • 0

I have a problem with my program. I am trying to run trough an array of pointers. Once the right pointer is found the program will print all the pointers that have been visited. I get error message at:

void * temp=debut[k]; 
ajouter(temp[k], resultat); 

it says “void value not ignored as it ought to be”

I don’t uderstand why???

thank you in advance for help

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

int calculerTaille(void * pointeur);
void ajouter(void * pointeur, char * resultat[]);
int verifier(void * debut, void * fin);

void * A[3];
void * D[3];
void * F[2];
void * G[4];
void * H[4];
void * J[3];
void * K[5];
void * L[4];
void * M[5];

int i = 0;

char * resultat[100];

int main(int argc, char * argv[]) {

A[0] = D;
A[1] = H;
A[2] = K;

D[0] = A;
D[1] = G;
D[2] = H;

F[0] = K;
F[1] = L;

G[0] = D;
G[1] = H;
G[2] = J;
G[3] = M;

H[0] = A;
H[1] = G;
H[2] = L;
H[3] = M;

J[0] = G;
J[1] = L;
J[2] = M;

K[0] = A;
K[1] = F;
K[2] = H;
K[3] = L;
K[4] = M;

L[0] = F;
L[1] = J;
L[2] = K;
L[3] = M;

M[0] = G;
M[1] = H;
M[2] = J;
M[3] = K;
M[4] = L;

void * debut = A;
void * fin = J;


ajouter(J, resultat);
while (verifier(debut, fin) != 1) {

    srand(time(0));
    int k = rand() % calculerTaille(K);

    void * temp=debut[k]; //error
    ajouter(temp[k], resultat); //error

}

int l=0;
for(l=0; resultat[l]!=NULL;l++) printf("%s ", resultat[l]);
return 0;
}

void ajouter(void * pointeur, char * resultat[]) {

if (pointeur == A)
    resultat[i] = "A";
if (pointeur == D)
    resultat[i] = "D";
if (pointeur == F)
    resultat[i] = "F";
if (pointeur == G)
    resultat[i] = "G";
if (pointeur == H)
    resultat[i] = "H";
if (pointeur == J)
    resultat[i] = "J";
if (pointeur == K)
    resultat[i] = "K";
if (pointeur == L)
    resultat[i] = "L";
if (pointeur == M)
    resultat[i] = "M";

i++;

}

int verifier(void * debut, void * fin) {
if (debut == fin)
    return 1;
else
    return 0;
}

int calculerTaille(void * pointeur) {
if (pointeur == A)
    return 3;
if (pointeur == D)
    return 3;
if (pointeur == F)
    return 2;
if (pointeur == G)
    return 4;
if (pointeur == H)
    return 4;
if (pointeur == J)
    return 3;
if (pointeur == K)
    return 5;
if (pointeur == L)
    return 4;
if (pointeur == M)
    return 5;

}
  • 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-25T02:50:42+00:00Added an answer on May 25, 2026 at 2:50 am

    debut is a pointer of type void *. You can’t use the [] operator with a pointer of type void *. It is illegal in C. What is that supposed to mean in your code?

    You compiler, obviously, allows you to use the [] with debut as a compiler-specific extension (this is nevertheless illegal in C). However, the result of debut[k] is an “lvalue” of type void. You can’t read a void. You can’t assign a void to anything. That just doesn’t make any sense. What were you trying to say by attempting to read the “value” of debut[k]?


    Taking into account your comment, apparently what you need is debut declared as

    void **debut;
    

    Note two asterisks.

    Again, if you want to access elements of the array void * A[3] through an independent pointer debut, the pointer debut has to be declared and initialized as follows

    void **debut = A;
    

    That way accessing debut[k] will actually access A[k].

    The same applies to fin. In fact, your program contains numerous independent instances of this error (see function parameters as well), although some of them are more “forgiving” than debut[k].

    P.S. Your cycle will loop infinitely, since you never change neither debut nor fin.

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

Sidebar

Related Questions

I have a problem I'm trying to solve involving interfaceing a C++ program with
I have a problem with my WPF program. I'm trying to create an object
with my RCP program I have the problem that I want to have more
I have a problem with debugging sessions. My program executes very well in a
I have a problem with the typedef keywords in C language. In my program,
I am working on kind of drawing program but I have a problem with
I'm almost finished with my program, but I have one problem that I can't
Consider this problem: I have a program which should fetch (let's say) 100 records
I have a strange problem, a deadlock problem, where if I pause the program
I have created Excel Sheet using Java program. It works fine. My problem is,

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.