Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7032887
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T00:59:32+00:00 2026-05-28T00:59:32+00:00

We know some escape sequence ‘\n’ – new line but say we don’t know

  • 0

We know some escape sequence ‘\n’ – new line but say we don’t know if \a, \b, \c …. \z is an escape sequence. How to write a program that allows us to test every character from a to z and/or A to Z in a printf statement or other way to identify an escape sequence and if it is, then print it’s value e.g. ouput may look like this:

‘\b’ is a special character and value of ‘\b’ = 8

This program may look silly but I am not able to find a solution for it…
Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T00:59:33+00:00Added an answer on May 28, 2026 at 12:59 am

    As Carl Norum pointed out, these are interpreted by the compiler. You can take an approach similar to autoconf (the program which generates configure scripts):

    #!/bin/bash
    
    for LETTER in {a..z}
    do
        cat > letter.c <<EOF
    #include <stdio.h>
    int main() { printf("\\\\$LETTER has ASCII value %u\n", "\\$LETTER"[0]); }
    EOF
        cc -Werror -o letter letter.c > /dev/null 2>&1 && ./letter
    done
    

    Output:

    \a has ASCII value 7
    \b has ASCII value 8
    \e has ASCII value 27
    \f has ASCII value 12
    \n has ASCII value 10
    \r has ASCII value 13
    \t has ASCII value 9
    \v has ASCII value 11
    

    Notes: The reason for a string constant rather than a character constant is simply shell quoting. This relies on gcc‘s -Werror but you could solve that problem in other ways.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know that this is some kind of special character issue but I do
I realized today that I don't know how to escape characters in comments for
I know that this question may be closed by some of you, but my
I know some of the escape characters in Java, e.g. \n : Newline \r
Do you know some neat Java libaries that allow you to make cartesian product
I do know some basic differences but there are still some questions in my
i would like know some reference. I know i can googling it. but prefer
Did anyone try that feature and has some feedback? Or Does anyone know some
As far as I know the JVM uses escape analysis for some performance optimisations
I know that this php code is bad <?php $id=$_SESSION['id']; ?> but it saves

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.