K_359's blog

By K_359, history, 7 years ago, In English

I'm getting runtime error. Exit code -1073741819. Can anyone explain why?

include<stdio.h>

include<string.h>

int main() { char *str; int i; scanf("%s",str); for(i=0;i<strlen(str);i++) { if(str[i]=='.') printf("0"); else //str[i]="-" so we check str[i+1] { i++; //it is given that string is valid if(str[i]=='.') // << -. >> printf("1"); else // << -- >> printf("2"); } } return 0; }

Full text and comments »

  • Vote: I like it
  • -1
  • Vote: I do not like it