Some of my worst interview memories are from a company where the VP leading hiring had ideas that candidates needed to be made to feel as comfortable and positive as possible and treated equally, including giving them the same interview length after they got past the screener.
The screener mostly filtered out unqualified candidates, but when someone slipped through and then was obviously not going to make it through the interview we all had to pretend that they were doing a great job and keep pushing through anyway. There was lots of fake encouragement that most candidates could see right through. Really painful for everyone to have to sit through interview sessions when everyone in the room, including the candidate, knows it's not going to work out.
This is one of those cases where "nice" != "compassionate". They applied for a job they were not qualified for. We could have been "nice" and held up the delusion that we were still considering them, and let them down later with some vacuous corporate platitude like "you were great but we ultimately gave the role to a stronger candidate". Providing instant feedback that their skills were just not up to snuff is not 'nice' but it's more compassionate in the long run.
I've ended plenty of interviews early when it's clear the candidate isn't going to work out. I agree there's no point in wasting everyone's time, and hiring is time consuming enough. But there's a way to do it with kindness, and I think everyone in the interviewer's chair should have some sense of how. (That said, there are some candidates that are going to take rejection poorly no matter what - you can control how you treat a candidate but now how they react).
You're right, however
> At one point I said literally, "You know this interview is for a C coding position, right?"
This is absolutely not the right way to go about it.
It's completely fair to say "hey, thanks for your time but we really need someone with C experience and we don't think you're a good fit for what we're looking for", but that's not even close to what it sounds like you did
You can cut an interview short and make it clear they won't be considered without being a huge asshole about it
To be honest though, the whole corporate world is institutionalized assholery, from giving candidates take-home coding assignments and then ghosting them, to laying people off without even giving them a chance to say goodbye to their coworkers. The entire leadership of that particular startup was assholes through and through. It's difficult to maintain one's humanity in the face of that (esp at a young age) and I'm glad to be out of that game.
I've interviewed candidates for jobs requiring highly specific skills who claimed to have those skills, but in the interview they kept trying to divert the topic to something else. An analogy would be bringing someone in for a C interview and they keep trying to write all the answers in Python and pretend that C and Python are interchangeable.
So some times, asking the candidate if they know what they're interviewing for is really called for. You want to be sure the person understood the interview, not that they were confused by the questions.