when I call display function it doesn't call in program and when I use this in main function without using it in function it works perfectly.
#include<stdio.h>
#include<conio.h>
#include<string.h>
#include<stdlib.h>
int main()
{
int d;
int choose;
int display();
printf("enter 1 to display and 2 to quit\n");
switch(choose)
{
case 1:
display();
break;
}
scanf("%s",choose);
int display();
system("cls");
}
int display()
{
char fname[20], str[500];
FILE *fp;
printf("Enter the Name of File: ");
gets(fname);
fp = fopen(fname, "r");
if(fp==NULL)
printf("Error Occurred while Opening the File!");
else
{
fscanf(fp, "%[^\0]", str);
printf("\nContent of File is:\n\n");
printf("%s", str);
}
fclose(fp);
getch();
return 0;
}
Any ideas what the error is?