Bus error in simple C program -


i have following simple program. , running "program file.txt" command line , getting "bus error" no output. don't know i'm doing wrong here.

#include<stdio.h>  int main(char *arg[]) {      file *file = fopen(arg[0], "r");      if (file == null) {         printf("cannot open file.\n");         exit(1);     }      return 1; } 

could print out value of arg[0], suppose type of main

int main(int argc, char* argv[]) 

and argv[0] name of process, argv[1] first argument.


Comments

Popular posts from this blog

jquery - Invalid Assignment Left-Hand Side -

javascript - Preserving URL fragment through CAS sign-on -

asp.net mvc - Implementing normal user/pass, Twitter & Facebook auth -