4

I have this struct:

typedef struct cmdLine {
char * const arguments[256];
} cmdLine;

I also have an argument cmdLine *pCmdLine. I want to use execvso I write execv((pCmdLine->arguments[0]), pCmdLine->arguments);. The second argument doesn't feet properly to execvand I want to ask how to convert it properly.

The warning I get is: Passing 'char* const[256]'' to parameter of type 'const char *const *' discards qualifiers in nested pointer types. I would lie for some help to convert it properly, thanks.

J. Doe
  • 299
  • 3
  • 12

1 Answers1

0

I do not see any problems:

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

#include <stdio.h>

struct
{
char * const arr[20];
}*str;

void foo(char  *const par[])
{
    volatile const char * const ptr = par[4]; 
    printf("%s\n", par[7]);
    printf("%s\n", ptr);
}


void foo1()
{
    foo(str -> arr);
}

https://godbolt.org/z/4Sv4a8

0___________
  • 60,014
  • 4
  • 34
  • 74