Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

460
Vistas
Using switch function to check for character ' in C

I have to make a program that allows the user to input characters then prints its decimal character code. One of the characters is ' but when I go to check for this character it says it is missing the terminating ' character.

case ''':
            printf("039");
            break;

How do I check for ' as a charcter?

over 4 years ago · Santiago Trujillo
3 Respuestas
Responde la pregunta

0

You can use an escape sequence.

case '\'':
            printf("039");
            break;
over 4 years ago · Santiago Trujillo Denunciar

0

You should use a backslash(\) before using ' . Because ' is a special character. So, you should use as follows,

case '\'':
            printf("039");
            break;
over 4 years ago · Santiago Trujillo Denunciar

0

You should use the \ character before the '. This is because in c the character ' is used as a opener or closer for a character value. This means you need to tell the compiler to treat it as a normal character by adding \ before it. The same thing goes for " and \ (if you want to use a backslash in a string instead of the purposes listed above.)

Using this method your case statement should look like this: case '\'':

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda