0

Why it is not working?

https://code.sololearn.com/cbQ8g2jlbu95/?ref=app ~/.../Download/Termux $ gcc argv_to_string.c -o argv argv_to_string.c:10:20: warning: passing 'char **' to parameter of type 'const char *const *' discards qualifiers in nested pointer types [-Wincompatible-pointer-types-discards-qualifiers] argv_to_string(argv, buff, 10); ^~~~ argv_to_string.c:6:42: note: passing argument to parameter here void argv_to_string(const char * const * , char *, size_t); ^ 1 warning generated. ~/.../Download/Termux $

29th Dec 2022, 4:53 PM
Jables
Jables - avatar
4 Answers
+ 3
you need to use the same type void argv_to_string(char*[], char *, size_t);
29th Dec 2022, 5:38 PM
Giannis
Giannis - avatar
+ 2
Jables have you considered using snprintf()? Or is it a requirement to write your own formatter? E.g., #include <stdio.h> int main (int argc, char *argv[]) { char buff[32]; snprintf(buff, 32, "[%s], [%s]", argv[0], argv[1]); printf("%s", buff); }
29th Dec 2022, 9:44 PM
Brian
Brian - avatar
+ 1
'char**' isn't the same as 'const char* const*'
29th Dec 2022, 5:30 PM
Giannis
Giannis - avatar
0
So how am i move argv to function Without changing value or address?
29th Dec 2022, 5:35 PM
Jables
Jables - avatar