Thread: Can't spot my mistake C

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Aug 2020
    Posts
    2

    Can't spot my mistake C

    I'm trying to make a simple program in C, which asks an input above 10 and prints it on the screen.
    Code:
    #include <cs50.h>
    #include <stdio.h>
    
    int main(void)
    {
      int h;
      do {
        int h = get_int("mispar\n");
      }
      while (h < 10);
      printf("%i\n", h);
    }
    and it replies me with:
    declaration shadows a local variable [-Werror,-Wshadow]
    int h =get_int("mispar\n");
    ^
    number.c:6:5: note: previous declaration is here
    int h;
    ^

    \

    Last edited by khjh15; 08-19-2020 at 09:58 AM. Reason: forgot something

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. I can't spot my mistake...
    By awsdert in forum C Programming
    Replies: 213
    Last Post: 11-23-2020, 07:32 AM
  2. can anyone help to spot mistake in the code
    By chess_queen in forum C Programming
    Replies: 1
    Last Post: 10-21-2012, 10:37 AM
  3. Can you spot my mistake?
    By Brewer in forum C Programming
    Replies: 13
    Last Post: 11-12-2006, 12:50 PM

Tags for this Thread