Skip to content

Instantly share code, notes, and snippets.

@lalala
Created November 10, 2011 08:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lalala/1354430 to your computer and use it in GitHub Desktop.
Save lalala/1354430 to your computer and use it in GitHub Desktop.
.
.
.
char *printenv[] = { "printenv", NULL };
char *sort[] = { "sort", NULL };
char *less[] = { "less", NULL };
unsigned int *pro[3] = { &printenv, &sort, &less };
.
.
.
#
# Gives this warning
#
gcc -Wall -ansi -g -o digenv digenv.c
digenv.c: In function ‘main’:
digenv.c:15:3: warning: initialization from incompatible pointer type [enabled by default]
digenv.c:15:3: warning: (near initialization for ‘pro[0]’) [enabled by default]
digenv.c:15:3: warning: initialization from incompatible pointer type [enabled by default]
digenv.c:15:3: warning: (near initialization for ‘pro[1]’) [enabled by default]
digenv.c:15:3: warning: initialization from incompatible pointer type [enabled by default]
digenv.c:15:3: warning: (near initialization for ‘pro[2]’) [enabled by default]
digenv.c:45:7: error: incompatible type for argument 1 of ‘execvp’
/usr/include/unistd.h:575:12: note: expected ‘const char *’ but argument is of type ‘float’
digenv.c:45:7: warning: passing argument 2 of ‘execvp’ from incompatible pointer type [enabled by default]
/usr/include/unistd.h:575:12: note: expected ‘char * const*’ but argument is of type ‘float *’
digenv.c:63:5: warning: implicit declaration of function ‘wait’ [-Wimplicit-function-declaration]
make: *** [digenv] Error 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment