
- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
A C Puzzle in C Programming?
In this C programming puzzle you need to merge two numbers. You cannot use any arithmetic, string or other functions.
So In This C Puzzle −
Input : 12 , 54 Output : 1254
Optimum solution to this C programming puzzle is to use the Token-pasting operator define.
Define a macros using this ## token-pasting operator gives you the merged value. This operator merges the tokens that are passed to it.
PROGRAM TO SOLVE THE C PUZZLE
#include <stdio.h> #define merge(a, b) b##a int main(void) { printf("%d ", merge(432 ,23)); return 0; }
Output
23432
- Related Questions & Answers
- A C Programming Language Puzzle?
- A C/C++ Pointer Puzzle?
- A C/C++ Function Call Puzzle?
- C/C++ Pointer Puzzle?
- A Puzzle using C Program
- Sliding Puzzle in C++
- A Product Array Puzzle in C++?
- A Sum Array Puzzle in C++?
- A Boolean Array Puzzle in C?
- A Product Array Puzzle in C?
- C/C++ Function Call Puzzle?
- A Puzzle on C/C++ R-Value Expressions?
- C++ Sum Array Puzzle
- A Boolean Array Puzzle In C Program?
- Verbal Arithmetic Puzzle in C++
Advertisements