On gcc-4.8.5
#include<iostream>
#include<stdio.h>
using namespace std;
#define CONVERT(a, str) (sprintf(str , "%llu", a))
int main()
{
char str[10];
CONVERT(10, str);
cout<<" Str = "<<str<<endl;
return 0;
}
Output - Str = 10
But the same code on DevC++ prints some junk value (always same). Not able to find the issue.
EDIT :- If i do - CONVERT((unsigned long long)10, str);
- it works fine.
But still question remains? Why this difference between these two compilers? Just there implementaion or something hidden in this?