Search
 
SCRIPT & CODE EXAMPLE
 

C

scopes in c

#include <stdio.h>
 
// Driver Code
int main()
{
    {
        int x = 10, y = 20;
        {
            // The outer block contains
            // declaration of x and
            // y, so following statement
            // is valid and prints
            // 10 and 20
            printf("x = %d, y = %d
", x, y);
            {
                // y is declared again,
                // so outer block y is
                // not accessible in this block
                int y = 40;
 
                // Changes the outer block
                // variable x to 11
                x++;
 
                // Changes this block's
                // variable y to 41
                y++;
 
                printf("x = %d, y = %d
", x, y);
            }
 
            // This statement accesses
            // only outer block's
            // variables
            printf("x = %d, y = %d
", x, y);
        }
    }
    return 0;
}
Comment

scope of variables in c

using namespace std
Comment

PREVIOUS NEXT
Code Example
C :: fifo in c 
C :: c check if character is lower case 
C :: majuscule en c 
C :: windows make clean 
C :: size of int in c 
C :: c calling a function 
C :: how to read and write to fiel n c 
C :: what is %d in C 
C :: example of source file 
C :: c sjf 
C :: columntransformer in randomizedsearchcv 
C :: cast from float to long c 
C :: arduino vscode upload choosing sketch 
C :: run steam as root 
C :: google business customer care number india 24/7 
C :: bool print variable in c 
C :: code wars responsable drinker 
C :: C if...else Statement 
C :: ssl_get_servername return null 
C :: visa germany algeria 
C :: elastic search url date 
C :: c joystick arduino 
C :: sscanf and sprintf in c 
C :: c multithreading sum from 0 to 1000 
C :: resize vm boot disk with empty space 
C :: passing an array of unspecified number of variables to a function 
C :: what is float in c 
C :: c code to algorithm converter online 
Dart :: flutter appbar backbutton remove 
Dart :: rel canonical tag 
ADD CONTENT
Topic
Content
Source link
Name
9+5 =