Question: I'm new to using linux and the bash command line but I was trying to see whether I could execute basic bash commands (or program) from a c file. My code is really simple and I could've sworn that it was working but suddenly it is not acknowledging that the path even exists.

```
char* arg[] = {"ls", "-l"};
char* environ[] = {"PATH=./", (char*)0};
execve("/bin/ls", arg, environ);/*execute the command 'ls -l' in curdir*/

```

I've tried to set as `PATH=/bin` but it's not even executing the command in that directory. it just returns a similar error.

NOTE: I have tried

```
char* environ[] = {"PATH=./", NULL};

```

I've even tried using the `envp` from main() and that STILL doesn't work.

Answer: 
Put NULL in the end of arg array.

```
char* arg[] = {"ls", "-l", NULL};

```

The NULL is used to mark the end of the array.
Please always post a complete program.

As said in the man page, and as said in the comments above, you need a `NULL` at the end of the arguments list.

You do not need to pass anything in `envp[]` since you are running just `ls`

By convention you should pass the full path of the executable in `argv[0]`

In short, this works

```
#include <stdio.h>
#include <unistd.h>

int main(void)
{
    char* arg[] = { "/bin/ls", "-l", NULL };
    execve("/bin/ls", arg, NULL);
    return 0;
}

```