Dynamic initialization of variables.

The below described is a program that shows how variables are declared in a dynamic manner. We can also initialize these variables dynamically. Hope this would be so simple for you. By trying some another examples, you can master on it.!



The program

// using simple dynamic initialization of variables

#include<iostream.h>
#include<conio.h>

void main()
{
clrscr();
int b,c=sizeof("xloi");    //dynamic initialization for 'c'
cout<<"\nvalue for b=";
cin>>b;
int q=b*1.3*c;  //dynamic initialization for 'q'
cout<<"q="<<q;
getch();
}

Popular posts from this blog

How to pass variables to res.render() in Node.js

Talky Messenger Documentation & Setup