filmov
tv
AddressOf Operator in C - C Programming Tutorial 35
Показать описание
Notes for You:: AddressOf Operator in C - C Programming Tutorial 35
- is used to get address (or reference) of a variable, or a constant.
Syntax:
&variableName
Example Code:
- C Progrm to display value and address of a variable.
#include <stdio.h>
int main()
{
int a=10, b=20;
printf("Value of a= %d\n",a); // 10
printf("Address of a= %p\n",&a); //0022FF1C
printf("Address of a= %d\n",&a); // 2293532
printf("\n");
printf("Value of b= %d\n",b); // 20
printf("Address of b= %p\n",&b); // 0022FF18
printf("Address of b= %d\n",&b); // 2293528
return 0;
}
Note:
- replace < with less-than symbol.
- replace > with greater-than symbol.
Note: Address of operator is used to
- read a value from the keyboard and assign it to some variable.
- assign address of a variable to a pointer and modify the value in it using pointer.
- pass address of a variable to a function and modify the value in it.
etc.
Example Code:
- C Program to find addition of 2 numbers.
#include <stdio.h>
int main()
{
int a=0, b=0, c=0;
printf("Enter a value for a:");
scanf("%d",&a); // 30
printf("Enter a value for b:");
scanf("%d",&b); // 40
c = a + b;
printf("Value of c= %d\n",c); // Value of c=70
return 0;
}
Note:
- replace < with less-than symbol.
- replace > with greater-than symbol.
=========================================
Follow the link for next video:
Follow the link for previous video:
=========================================
C Programming Tutorials Playlist:
=========================================
Watch My Other Useful Tutorials:-
Computer Programming Fundamentals Playlist:-
C Practical LAB Exercises Playlist:-
C++ Tutorials Playlist:
=========================================
► Subscribe to our YouTube channel:
► Visit our Website:
=========================================
Hash Tags:-
#ChidresTechTutorials #CProgramming #CProgrammingTutorial
- is used to get address (or reference) of a variable, or a constant.
Syntax:
&variableName
Example Code:
- C Progrm to display value and address of a variable.
#include <stdio.h>
int main()
{
int a=10, b=20;
printf("Value of a= %d\n",a); // 10
printf("Address of a= %p\n",&a); //0022FF1C
printf("Address of a= %d\n",&a); // 2293532
printf("\n");
printf("Value of b= %d\n",b); // 20
printf("Address of b= %p\n",&b); // 0022FF18
printf("Address of b= %d\n",&b); // 2293528
return 0;
}
Note:
- replace < with less-than symbol.
- replace > with greater-than symbol.
Note: Address of operator is used to
- read a value from the keyboard and assign it to some variable.
- assign address of a variable to a pointer and modify the value in it using pointer.
- pass address of a variable to a function and modify the value in it.
etc.
Example Code:
- C Program to find addition of 2 numbers.
#include <stdio.h>
int main()
{
int a=0, b=0, c=0;
printf("Enter a value for a:");
scanf("%d",&a); // 30
printf("Enter a value for b:");
scanf("%d",&b); // 40
c = a + b;
printf("Value of c= %d\n",c); // Value of c=70
return 0;
}
Note:
- replace < with less-than symbol.
- replace > with greater-than symbol.
=========================================
Follow the link for next video:
Follow the link for previous video:
=========================================
C Programming Tutorials Playlist:
=========================================
Watch My Other Useful Tutorials:-
Computer Programming Fundamentals Playlist:-
C Practical LAB Exercises Playlist:-
C++ Tutorials Playlist:
=========================================
► Subscribe to our YouTube channel:
► Visit our Website:
=========================================
Hash Tags:-
#ChidresTechTutorials #CProgramming #CProgrammingTutorial
Комментарии