I am currently doing the K&R book and this is the solution I came up with. I'm guessing it is not a solution as it is too simple but I thought I would put it up for discussion.
i = 0; while (i < lim -1) if (c = getchar() != '\n') if (c != EOF) ++i;
I am currently doing the K&R book and this is the solution I came up with. I'm guessing it is not a solution as it is too simple but I thought I would put it up for discussion.
i = 0; while (i < lim -1) if (c = getchar() != '\n') if (c != EOF) ++i;