typedef int c[12];
c name={1,2,3,4};
cout<<name[0];
how does the above code work ??
Type: Posts; User: mohnish_khiani
typedef int c[12];
c name={1,2,3,4};
cout<<name[0];
how does the above code work ??
these are valid :
char str[5]="good";
int a[3]={1,2,3};
char *p="hello";
but why is this wrong then :
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
void main()
{
int a=10,*x=&a;
float *b;
float c;
clrscr();
b=&a;
yaa it prints world the second time....thus resulting in unpredictable behaviour...
Then what is the use of delete or free when we can retrieve the value after using them???
why is it happening so???
void main()
{
char *x="hello";
printf("%s \n",x);
delete x;
printf("%s \n",x);
getch();
@all....thank you everyone...got it.....
......can i continue asking my doubts on this forum...or am i at the wrong place???
thank you Tater.....but the question i asked was just out of my curiosity...i couldn't find it in my books which goes on comparing the effects of keywords in this case coz there can then be many...
@rogster001....thank you.
@adeyblue...who ever u may be.....these are not my "QUIZ QUESTIONS" as u think....can't answer them...just mind our own work rather than scribbling some crap here...no...
k....thanks
what i understood is that when a variable is declared as static it doesn't loose it's value even if the scope of the function within which it is declared is finished and a global variable is the one...
sorry for that #define blunder...it's solved now....
but i still didn't get the difference b/w the two declarations...regarding there scope,lifetime and usage
#include<stdio.h>...
what,where and how will there be differences in constant declaration when this is done:
#define a 10
(or)
const int a=10;
no no this is a doubt i had......
then how is the declaration of q different if had declared it as
extern int q;
#include<stdio.h>
#include<conio.h>
static int p=10;
int q=10;
void main()
{
printf("%d %d",p,q);
getch();
}
sorry for that....
#include<stdio.h>
#include<conio.h>
#define a 90;
void main()
{
char x=a;
int b=10;
float c=30.0f;
clrscr();
printf("%c %f \n",x,c);