I am learning linux programming and came across exec function which is kind of very useful. But the problem is exec function arguments are very confusing and I am unable to
The purpose of the ending argument (char *) 0 is to terminate the parameters. Undefined behavior may result if this is missing.
The man page defines the execl signature as :
int execl(const char *path, const char *arg, ...);
path: The location of the program to invoke, the program to invoke.
arg, ...*: can be thought of as arg0, arg1, ..., argn.
In your case execl( "/bin/ls", "ls", "-l", (char*)0 ); is the correct function call.
"bin/ls" the program to invoke
"ls" the program name
"-l" is the parameter for that program called