Return pointer from function C
In my C program this function is going to handle all the work of opening a specific file and then return the file pointer, so main or other functions can read the content by using fp, but so far i haven't been able to get this to work.

I'm just learning the language, so it is possible that i am doing something very wrong.

    int open_text_file(char text_file_name[])
    {
        FILE *fp;

        if((fp = fopen(text_file_name, "r")) != 0)
        {
                return fp;
        }

        else
        {
                printf("Cannot open file \"%s\"\n", text_file_name);
        }
    }

Return pointer from function C
===

In my C program this function is going to handle all the work of opening a specific file and then return the file pointer, so main or other functions can read the content by using fp, but so far i haven't been able to get this to work.

I'm just learning the language, so it is possible that i am doing something very wrong.

    int open_text_file(char text_file_name[])
    {
        FILE *fp;

        if((fp = fopen(text_file_name, "r")) != 0)
        {
                return fp;
        }

        else
        {
                printf("Cannot open file \"%s\"\n", text_file_name);
        }
    }
