I had to make a wrapper program on "nslookup" networking utility and I am facing the following "Segmentation Fault error"
Code:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, char* argv[])
{
const char *d;
char *s=NULL;
char *x=NULL;
d=argv[1];
s="nslookup";
x=strcat(s,d);
system(s);
return 0;
}
I have no compilation errors.
Strcat function call:
Code:
char *strcat(char *s1, const char *s2);
I need some help because i am not able to figure out what i am doing wrong.