Islamshahin
Technical User
I used Borland turbo C++3 and Borland turbo C++ 3.1 (Under dos and under windows) and I didn't face this problem ever.
The problem is, when I use a very simple cosole project in Borlan Turbo C++6.0 Explorer and write this code:
/* Starting of the code*/
#include <stdio.h>
void main(void)
{
char *t;
printf("Input a string line: ");
scanf("%s",t);
printf("%s",t);
getch();
}
//End
the code works well, but if I identify any other pointer or variable in the same function like that:
/* Starting of the code*/
#include <stdio.h>
/*it works if I identify any other variable globaly*/
void main(void)
{
char *t,*y; /* adding any poiner or variable*/
printf("Input a string line: ");
scanf("%s",t);
printf("%s",t);
getch();
}
//End
this code can't excute (scanf) line, and gives me a window of (access Violation)which gives me two options (break or continue).
If I change the pointer identification with an array,it works well as well.
I think it's a very simple, but it stops me to use this version.
thanks
The problem is, when I use a very simple cosole project in Borlan Turbo C++6.0 Explorer and write this code:
/* Starting of the code*/
#include <stdio.h>
void main(void)
{
char *t;
printf("Input a string line: ");
scanf("%s",t);
printf("%s",t);
getch();
}
//End
the code works well, but if I identify any other pointer or variable in the same function like that:
/* Starting of the code*/
#include <stdio.h>
/*it works if I identify any other variable globaly*/
void main(void)
{
char *t,*y; /* adding any poiner or variable*/
printf("Input a string line: ");
scanf("%s",t);
printf("%s",t);
getch();
}
//End
this code can't excute (scanf) line, and gives me a window of (access Violation)which gives me two options (break or continue).
If I change the pointer identification with an array,it works well as well.
I think it's a very simple, but it stops me to use this version.
thanks