Hi listers,
I have a problem, if the below given code is executed it works properly. But
if the "int i;" is given in the first line of the main function, the pgm
compiles properly but if i excute it then core is dumped saying that
segmentation fault, the pgm exited with signal 11.

One more thing is that, cant we execute exit commamd using the C system()
function. First i thought that it is not in path but when i tried with
"whereis exit" I couldn't find the excutable. But it works in shell.

Someone plz explain me this.

#include<stdio.h>
#include<string.h>
int main(void){
  char *pass="logu";
  char *s;
  int i;

  printf("Enter the passwd: ");
  scanf("%s",s);

  if(strcmp(s,pass)){
    system("exit");
    printf("Command done\n");
  }
  else
    printf("Not Executed\n");

  return 1;

  }



-Logu


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


_______________________________________________
linux-india-help mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/linux-india-help

Reply via email to