int main(int argc, char** argv) { int i=5; { int i=7; printf("%d\n", i); } return 0; }
If I want to access the external value i( int i=5) in printf, then how to do it?
i
int i=5
printf
Relevant part of C99, section 6.2.1 (Identifier areas):
4 [...] , . , ( ) ( ). , ; , , ( ) .
pmg answer : , , :
int i = 5; { int *p = &i; int i = 7; printf("%d\n", *p); /* prints "5" */ }
, .
i , i. -
int i = 5; { int p = i; int i = 7; printf("%d\n", p); /* prints "5" */ }
.
You cannot access it.
I don’t understand why you cannot name “I” and “J”.
Different names for them let you choose.
Point to the old ione before defining a new one. (demo at http://ideone.com/dobQX )
But I love the way Jonathan comments on the best!
Short answer: you cannot. It is hidden iin the inner area.
Source: https://habr.com/ru/post/1768432/More articles:how to initialize a two-dimensional array of PHP - phpClosing the secondary form of delphi causes the main form to lose focus - winapiAnswers_transparent in rails 3 - ruby-on-railshttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1768430/ways-to-implement-janrain-engage-rpxnow-on-google-app-engine&usg=ALkJrhiRkAod_PkaNbHPxl7EaFuUUrdbywHow to sign a PDF with electronic signature in PDFSharp? - c #Есть ли способ отобразить график вызовов функций? - language-agnosticJ2ME: Получить только год/месяц/день с DateField - java-meZend Structure, URL Browsing Assistant and Layout - url-routingHow can I get rid of “Release 1” in the Sphinx output latex page header? - documentationStart template animation as soon as the control is loaded - templatesAll Articles