c - How to merge array elements with token merging ## operator??? -
i want merge 3, 7, 1 371. want know how merge it???
#include <stdio.h> int main(void) { int a[] ={3, 7, 1}; return(0); }
you try this;
#include <stdio.h> int main(void) { int a[] ={3, 7, 1}; int i, result = 0; for(i=0;i<sizeof(a)/sizeof(a[0]);i++) result += a[i] * pow(10, sizeof(a)/sizeof(a[0])-i-1); printf("result %d\n", result); return(0); }
Comments
Post a Comment