I am making a program which prints a character from an array with printf but it is just spitting out "random" symbols.
this is how I am doing it.
Code:
printf("%c",info[get]);
get is an int that says which character to get.
Thanks
all my code. (you will probably wonder what I am doing. It is the beginning of a scrambled word unscrambler . Still have to get the math of it down though.)
Code:
#include <stdio.h>
int main()
{
int lasttime = 0;
int stoploop;
int check;
int word = 25;
FILE *pfile;
int get = 0;
char getit;
char point[50];
char info[20];
scanf("%s",&point);
pfile = fopen("find","w");
fprintf(pfile,"%s",point);
fclose(pfile);
pfile = fopen("find","r");
while((getit = fgetc(pfile))!= EOF)
{
info[get];
get++;
}
stoploop = get + 1;
while(check<=word)
{
if(get == stoploop)
{
get = lasttime + 1;
get = lasttime;
printf("\n");
}
else if(get < 6)
{
printf("%c",info[get]);
check++;
get++;
}
}
getch();
return 0;
}