Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <cs50.h>
- #include <stdio.h>
- int main (void)
- {
- char hash = '#';
- char space =' ';
- int height = 0;
- {
- do
- {
- printf("height: ");
- int height = get_int();
- }
- while
- ( height > 1 && height< 24 );
- for
- ( char hash = 0 ; hash > 1 ; hash++ )
- printf (" # %c\n" , hash );
- printf(" %c\n" , space + height);
- } if ( height < 1 || height > 24)
- printf(" error %c\n" , hash );
- }
- ERROR
- mario.c:15:8: error: declaration shadows a local
- variable [-Werror,-Wshadow]
- int height = get_int();
- ^
- mario.c:10:8: note: previous declaration is here
- int height = 0;
- ^
- mario.c:15:8: error: unused variable 'height'
- [-Werror,-Wunused-variable]
- int height = get_int();
- ^
- mario.c:18:2: error: expected 'while' in do/while loop
- {
- ^
- mario.c:12:4: note: to match this 'do'
- do
- ^
- 3 errors generated.
- make: *** [mario] Error 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement