-1
    #include <stdio.h>
#include <stdlib.h>
#include <conio.h>

int main(){
    printf("Bir sayı gir");
    int i;
    scanf("%d",&i);
    printf("%d=",i);

    return 0;
}

Error 2 error C2065: 'i' : undeclared identifier 9 1 C What does it mean?

user207421
  • 305,947
  • 44
  • 307
  • 483
  • The tag `compiler` should be applied to questions concerning the programming of compilers or for questions about the detailed inner workings of compilers. Don't use `compiler` for questions about options and settings for a particular compiler, use the name of the compiler you are interested in instead. – user207421 Nov 14 '13 at 00:41
  • Are you sure that's the only error you got? A compiler that doesn't support mixed declarations and statements should report an error on `int i;`. And are you sure the code you posted is *exactly* what you fed to the compiler? Did you copy-and-paste it? Finally, what is the `num1` mentioned in your title? Please edit your question to make the title and the question both consistent with your actual code. – Keith Thompson Nov 14 '13 at 00:56
  • possible duplicate of [What is an 'undeclared identifier' error and how do I fix it?](http://stackoverflow.com/questions/22197030/what-is-an-undeclared-identifier-error-and-how-do-i-fix-it) – sashoalm Feb 09 '15 at 17:17

1 Answers1

1

Variable declaration should be at the beginning of the function block. Declare int i before first printf.

int main(){
  int i=0;
  printf("Bir sayı gir");
  ...
Sunil Bojanapally
  • 12,528
  • 4
  • 33
  • 46
  • @el_Pueblo_13 what system are you using ? show us how are you compiling the code ... because this code works – sukhvir Nov 09 '13 at 12:14
  • Mic Visual stdio 2012 ultimate – el_Pueblo_13 Nov 09 '13 at 12:17
  • @el_Pueblo_13 As others said this code compiles without any problem. Actually in present C compilers C11 & C99 you can declare variables at any place in the block. However older c89 supported by MVS has this problem. I would say you should start with a real C compiler such as mingw on windows. – Sunil Bojanapally Nov 09 '13 at 12:26