Try this ,
#include <stdio.h> int main(int argc,char *argv[]) { printf("executable name %s\n",argv[0]); return 0; }
#include<stdio.h> #include<string.h> main(int argc,char **argv) { char ch[20]; ch = strtok(argv[1],"."); strcat(ch,".o"); printf("executalbe file name is %s\n",ch); }
Code should compile and print out itself.