Does compound literals techinque reserve a memory ?
if i say
int x;
x=(int){1}+(int){2};

or
total_sum=sum_arr((int[]){1,2,3});

and what's the best situation to use this techinque ?

Recommended Answers

All 2 Replies

Where is your code for the sum_arr() function? Your code as it is makes no sense... Why are you using curly braces for x=(int){1}+(int){2}; etc? Do you have a slightest clue what you are doing?

i just use it as an example , the implementation of the sum_arr() is not important[it just a function that sums the elements of the array].

my main question, what's the compilar do(optimization,less memory usage ...etc) when i use compound literals ?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.