Having this statement:
dist[i]= min(dist[i],dist[j]+edge[j][i]);
How safe the corresponding following macro (in C) is:
#define MIN(d[i], edge[i][j]) (d[i] < edge[i][j] ? (d[i]) : (edge[i][j]))
Thank you.
Having this statement:
dist[i]= min(dist[i],dist[j]+edge[j][i]);
How safe the corresponding following macro (in C) is:
#define MIN(d[i], edge[i][j]) (d[i] < edge[i][j] ? (d[i]) : (edge[i][j]))
Thank you.
If you want a Min definition macro you need to do it like that
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
Like said in comment, macros need identifiers and not array, not even variables. But this macros is note type safe. Why not using fmax and fmin? It's better and you dont have to create a macro