Stack Exchange Network
Stack Exchange network consists of 181 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
Visit Stack Exchange
CS50 Stack Exchange is a question and answer site for students of Harvard University's CS50. It only takes a minute to sign up.
Sign up to join this community
Anybody can ask a question
The best answers are voted up and rise to the top
My code looks fine but "make mario" insists that "Error: use of undeclared identifier 'j'".
n = get_int ("Height: ");
while (n < 1 || n > 8);
for (int i = 0; i < n; i++)
for (int k = (8 - j); k < n; k++)
for (int j = (n - i); j < n; j++ )
asked May 25, 2020 at 2:59
You did use an undeclared identifier j in the second for loop. It isn't created until and only inside the following 3rd for loop.
The compiler never lies. It might mislead on occasion, but it never lies.
answered May 25, 2020 at 3:07
Cliff BCliff B
66.7k44 gold badges3131 silver badges5656 bronze badges
You must log in to answer this question.
Not the answer you're looking for? Browse other questions tagged