
- C Programming Tutorial
- C - Home
- C - Overview
- C - Environment Setup
- C - Program Structure
- C - Basic Syntax
- C - Data Types
- C - Variables
- C - Constants
- C - Storage Classes
- C - Operators
- C - Decision Making
- C - Loops
- C - Functions
- C - Scope Rules
- C - Arrays
- C - Pointers
- C - Strings
- C - Structures
- C - Unions
- C - Bit Fields
- C - Typedef
- C - Input & Output
- C - File I/O
- C - Preprocessors
- C - Header Files
- C - Type Casting
- C - Error Handling
- C - Recursion
- C - Variable Arguments
- C - Memory Management
- C - Command Line Arguments
- C Programming useful Resources
- C - Questions & Answers
- C - Quick Guide
- C - Useful Resources
- C - Discussion
A C Programming Language Puzzle?
Here we will see one C programming language puzzle question. Suppose we have two numbers 48 and 96. We have to add the first number after the second one. So final result will be like 9648. But we cannot use any logical, arithmetic, string related operations, also cannot use any pre-defined functions. So how can we do that?
This is easy. We can do by using Token Pasting operator(##) in C. The Token Pasting operator is a preprocessor operator. It sends commands to compiler to add or concatenate two tokens into one string. We use this operator at the macro definition.
Example
#include<stdio.h> #define MERGE(x, y) y##x main() { printf("%d", MERGE(48, 96)); }
Output
9648
- Related Articles
- A C Puzzle in C Programming?
- C++ Programming Language Features
- C Programming Language Standard
- Basics of C++ Programming Language?
- Comments in C++ Programming Language
- What is C++ programming language?
- Limitations of C programming language
- Why C++ is the Best Programming Language?
- What are macros in C programming language?
- Is Python a programming language or simply a scripting language?
- What are the advantages of C++ Programming Language?
- Why files are needed in C programming language?
- Explain monolithic and modular programming in C language
- Explain array of pointers in C programming language
- A C/C++ Pointer Puzzle?

Advertisements