"How to list files in a directory in C?"

"How to avoid special char(*,%,^..) in keydown event?"

"How to texture a quad in Gtk?"

"How to stop the title bar from blocking the main thread in Metal?"

These are all examples of questions/comments I could/have seen on StackOverflow. Is the complete sentence, "How to do something?" wrong? I doesn't sound right, but is it wrong?

How to ask how to do something correctly?

  • 1
    I wouldn't call it right or wrong. It's just not a sentence. Nor is it an interrogative sentence. This makes the presence of the question mark look quite strange. – Isabel Archer Jun 11 at 0:39
  • @IsabelArcher What I mean is as an interrogative sentence. – user388306 Jun 11 at 0:40
  • 2
    It isn't an interrogative sentence. For example, there's no subject. "How do you list files in a directory in C?" would be a sentence. – Isabel Archer Jun 11 at 0:44
  • @IsabelArcher Ah. I understand now. Thanks. – user388306 Jun 11 at 0:44
  • 1
    They look like titles to questions to me. Sort of like headlines. – Hot Licks Jun 11 at 0:50

It's the difference between a main clause and a content clause, and a tensed vs infinitival interrogative construction.

Interrogative main clause :

How does one list files in a directory in C?

Interrogative content clause:

Please tell me how one lists files in a directory in C.

The subordinate clause above is tensed - it has a a primary verb form.

Infinitival interrogative clause:

Please tell me how to list files in a directory in C.

Here we have an infinitival interrogative clause. These are allowed as subordinates only - where interrogative content clauses are allowed. (CaGEL p1264)

Since it's so prevalent on the internet, using the subordinate infinitival interrogative without a matrix clause might have slipped into informal use, but it would not be accepted as grammatical in any serious conversation or publication.

| improve this answer | |
  • 1
    Thanks for your help – user388306 Jun 11 at 2:07

These are not questions. These are relative infinitives, like what to order, who to tell, when to leave, or which one to pick. Putting a question mark after them does not make them questions. Relative infinitives are often used in lists, like journalists' bullet points: what, where, when, how, who, why, ..

They can be used as embedded question complement clauses, with the right verbs and constructions:

  • He asked her what to do.
  • She knows when to do it.
  • How to make sure it works is a problem.

But they aren't questions by themselves. There are several ways to make questions in English, but these are sposta be Wh-questions. There's really only one way to make them, and it doesn't involve infinitives. Here's the rule:

  1. Start with a statement that has a missing or unknown part you want to ask about, e.g,
    You can list files in Directory A by using Program ??
  2. Substitute the appropriate Wh-word for the missing part, e.g,
    You can list files in Directory A how
  3. Form a Yes/No question from the modified statement, e.g,
    Can you list files in Directory A how?
  4. Move the Wh-word to the beginning of the Yes/No question, e.g,
    How can you list files in Directory A?

Note that the question has its subject (you) and its first auxiliary inverted (can you instead of you can). It doesn't use to.

Infinitives with to are strictly subordinate clauses. But, in posters, advertisements, slogans, songs, bullet lists, raps, movies, slideshows, poems, and other spontaneous or artistic language, grammar does not constrain.

| improve this answer | |
  • 1
    Thanks for your time and the detailed answer – user388306 Jun 11 at 2:06

Yes, they are grammatically incorrect, because the are sentence fragments. However, I wouldn't call them "wrong", because there is no rule that says that the titles of the questions in stack overflow have to be 100% grammatically correct. They get the poster's meaning across in a clear and concise way.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.