A PHP Error was encountered

Severity: 8192

Message: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated

Filename: libraries/Filtered_db.php

Line Number: 23

C program to create, initialize, assign and access a pointer variable
Q:

C program to create, initialize, assign and access a pointer variable

0

C program to create, initialize, assign and access a pointer variable

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Program:

/*C program to create, initialize, assign and access a pointer variable.*/

#include <stdio.h>

int main()
{
    int num;    /*declaration of integer variable*/
    int *pNum;  /*declaration of integer pointer*/
 
    pNum=& num; /*assigning address of num*/
    num=100;    /*assigning 100 to variable num*/
 
    //access value and address using variable num
    printf("Using variable num:\n");
    printf("value of num: %d\naddress of num: %u\n",num,&num);
    //access value and address using pointer variable num
    printf("Using pointer variable:\n");
    printf("value of num: %d\naddress of num: %u\n",*pNum,pNum);
 
   return 0;
}

Output

    Using variable num:
    value of num: 100
    address of num: 2764564284
    Using pointer variable:
    value of num: 100
    address of num: 2764564284

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now