![Trending Articles on Technical and Non Technical topics](/images/trending_categories.jpeg)
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- 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
Advertisements