• ¿Documento equivocado? Cámbialo gratis
  • Escrito por estudiantes que aprobaron
  • Inmediatamente disponible después del pago
  • Leer en línea o como PDF
Vender
¿Dónde estudias?
Tu idioma
Document preview thumbnail
Vista previa 1 fuera de 1 páginas
Notas de lectura

Class notes C programming LET US C SOLUTIONS -15TH EDITION

Document preview thumbnail
Vista previa 1 fuera de 1 páginas

Scopes and variables

Vista previa del contenido

Scope of Variables – Local vs Global

today our topic of concern is to study scope of variables. outline
of today 's lecture is to define scope of a variable local variable
and global variable. we are going to understand what is local
variable and global variable. what is scope . scope is nothing but
a lifetime or you can say lifetime of a variable. contents of this
block up to this point are visible to the internal block. contents of
internal block are not visible to outer block. therefore it will not
be able to print this variable you can say. and it will produce an
error which is variable undeclared. that is what we call as a
scope. this is called redefinition of a variable. this is something
which is not allowed at all. you are not allowed to declare or
define another variable of same name within the same block. and
this is something similar to what we have seen over here. if you
want to define two variables with same name but in different
blocks, then it is possible.
We are going to have a lot of discussion on function prototypes.
right now, you wo n't need to bother about it at all. let 's try to
understand this code snippet which is available over here.. here I
have defined a prototype of a function. here you wont get any
error because you are not redefining within same block but within
different blocks. there is no local variable inside this function..
compiler will look for a global variable and it will print the
contents of this global variable.. This is what we call the use of
global variable. thank you for your knowledge of how to use
global variable in your work..

Libro relacionado
 image
Editorial: 2018 ISBN: 9788183331777 Edición: Desconocido

Información del documento

Subido en
6 de mayo de 2023
Número de páginas
1
Escrito en
2022/2023
Tipo
Notas de lectura
Profesor(es)
Sharadha
Contiene
Todas las clases
$9.49

¿Documento equivocado? Cámbialo gratis Dentro de los 14 días posteriores a la compra y antes de descargarlo, puedes elegir otro documento. Puedes gastar el importe de nuevo.
Escrito por estudiantes que aprobaron
Inmediatamente disponible después del pago
Leer en línea o como PDF

Vendido
0
Seguidores
0
Artículos
5
Última venta
-



Por qué los estudiantes eligen Stuvia

Creado por compañeros estudiantes, verificado por reseñas

Calidad en la que puedes confiar: escrito por estudiantes que aprobaron y evaluado por otros que han usado estos resúmenes.

¿No estás satisfecho? Elige otro documento

¡No te preocupes! Puedes elegir directamente otro documento que se ajuste mejor a lo que buscas.

Paga como quieras, empieza a estudiar al instante

Sin suscripción, sin compromisos. Paga como estés acostumbrado con tarjeta de crédito y descarga tu documento PDF inmediatamente.

Student with book image

“Comprado, descargado y aprobado. Así de fácil puede ser.”

Alisha Student

Preguntas frecuentes