'The condition within the while statement
How can I write a condition that fulfills the same condition as inside the while clause without using a <stdbool.h>
void show_path(int a[][5])
{
int i = 0;
int j = 0;
int cost = 0;
cost = a[j][i];
printf("Path = ");
bool x = i==4&&j==3;
while (!x)
{
if (a[j][i + 1] < a[j + 1][i])
{
printf("right ");
i++;
}
else if (a[j][i + 1] > a[j + 1][i])
{
printf("down ");
j++;
}
cost += a[j][i];
x = i==4&&j==3;
}
printf("\ncost =%d", cost);}
i tried to do it like while(!( i==4&&j==3)) but it didn't work.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
