I was going through some C code and this bit caught my eye and was wondering what is the '\n' bit about, as far as I know \n means new line, but i<'\n' ?
for(i=0;i<'\n';i++)
And just in case here is the code, it reads from a file and prints it:
case 1: {
FILE* fp;
fp = fopen("input.txt", "r");
for(i=0;i<'\n';i++) // This is the line
{
//read and save data from file
fscanf(fp,"%s%c%f%c%f%c%d%c%d%c%d%c%d%c\n",
my_tools[i].name,&ch,
&my_tools[i].ocost,&ch,
&my_tools[i].scost,&ch,
&my_tools[i].number,&ch,
&my_tools[i].month,&ch,
&my_tools[i].year,&ch,
&my_tools[i].numorder,&ch);
'\n' means Newline. It means while i does not equal a newline I guess. I don't think that is possible though? Because if you increment i it will never equal newline so the loop will never end. Also, I noticed you're using C instead of C++. It still is close enough for me to realize it's pointless to have that for loop. It would be more efficient to use a while loop.