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 136257
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T06:55:11+00:00 2026-05-11T06:55:11+00:00

I have a file with about 100 #defines in it, from 1-100, and each

  • 0

I have a file with about 100 #defines in it, from 1-100, and each with a unique string value.

Now I’m trying to print this value, but instead of the value, I want to print what the #define is. For example:

#define FIRST_VALUE 1 var = FIRST_VALUE; printf('%s', var); 

and I want the printf to print FIRST_VALUE, not 1.

Is there any way to do this in C? Or must I just write out 100+ case blocks inside a switch statement?

  • 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. 2026-05-11T06:55:12+00:00Added an answer on May 11, 2026 at 6:55 am

    After talking to one of my TA’s at school, we’ve decided that the best way to do this would be to write an AWK script to process the header file and automatically generate all the case statements needed.

    Thanks guys!

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

Sidebar

Related Questions

I have a String[] LinesFromFile which contains about 100 lines loaded from a file
I have an file. Each value looks like this: Peter | Stuart | 10293
I have a relational database with about 100 tables. Each table has unique, numerical,
I have forms with about 100 input fields each (textbox, textarea, radio, checkbox, file,
I have always wondered about this. So many application setups have a zip file
I have two perforce clients (client-a, client-b) that each contain about 40 file specs.
I have a gz file that is about 100 GB, I need to split
I have scanned a set of about 100 printed photographs, giving each one a
I have a .txt file with about 100,000 points in the 2-D plane. When
I have a binary file (about 100 MB) that I need to read in quickly.

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.