|
|
Inappropriate
|
See Answer
To Email:
Subject:
Note to go along with the question: (Optional, no
more than 1,000 characters)
both are same. a[i] is treated as *(a+i), and i[a] is *(i+a). And from the rule of associativity, we can see that both expressions will yield to the same result.
Create Date
:
Saturday, March 15, 2008
Click here
to improve the Interview Question, Answer and other fields.
|
|
Inappropriate
|
See Answer
To Email:
Subject:
Note to go along with the question: (Optional, no
more than 1,000 characters)
int main ()
{ int i,j,k;
for(i=1;i<4;i++)
{ for(j=1;j<4;j++)
{ for(k=1;k<4;k++)
{ if((i!=j) && (j!=k) && (i!=k))
{ printf("%d%d%dn",i,j,k);
}}}}}
Create Date
:
Saturday, March 15, 2008
Click here
to improve the Interview Question, Answer and other fields.
|
|
Inappropriate
|
See Answer
To Email:
Subject:
Note to go along with the question: (Optional, no
more than 1,000 characters)
heap memory used for dynamic memory allocation using malloc,realloc,new etc
global and static variable are stored in data segment.
Create Date
:
Saturday, March 15, 2008
Click here
to improve the Interview Question, Answer and other fields.
|
|
Inappropriate
|
See Answer
To Email:
Subject:
Note to go along with the question: (Optional, no
more than 1,000 characters)
String is a collection of charecter,it must be ended with null.
Charecter array is aset of elements if you didn't give a space for null,it shows error.
Create Date
:
Saturday, March 15, 2008
Click here
to improve the Interview Question, Answer and other fields.
|
|
Inappropriate
|
See Answer
To Email:
Subject:
Note to go along with the question: (Optional, no
more than 1,000 characters)
The size of the structutre will be the total size of fields holded by that structure.
Create Date
:
Saturday, March 15, 2008
Click here
to improve the Interview Question, Answer and other fields.
|
|
Inappropriate
|
See Answer
To Email:
Subject:
Note to go along with the question: (Optional, no
more than 1,000 characters)
There are various things to be observed for this
1. First of all while at the time of storing
single character is stored as char abc = 's';
where as string having single character can be stored as char pqr[] = "s";
2. single character takes one byte for storage
String (even single character is stored) takes two bytes, one for one character and second for null character
This can be verified by following C statement:
printf("%d %d", sizeof(abc), sizeof(pqr));
which gives output as 1 and 2 respectively. (assuming turbo C compiler and 1 byte for char)
Create Date
:
Saturday, March 15, 2008
Click here
to improve the Interview Question, Answer and other fields.
|
|
Inappropriate
|
See Answer
To Email:
Subject:
Note to go along with the question: (Optional, no
more than 1,000 characters)
-> The same auto variable name can be used in different blocks-> There is no side effect by changing the values in the blocks
-> The memory is economically used-> Auto variables have inherent protection because of local scope
Create Date
:
Saturday, March 15, 2008
Click here
to improve the Interview Question, Answer and other fields.
|
|
Inappropriate
|
See Answer
To Email:
Subject:
Note to go along with the question: (Optional, no
more than 1,000 characters)
most of the times you need to zero out the mem by using bzero or memset.U need not do it that way here.And also if it is to be alocated for a string,strlen(allocated array) is automatically 0.Which is a much safer method
Create Date
:
Saturday, March 15, 2008
Click here
to improve the Interview Question, Answer and other fields.
|
|
Inappropriate
|
See Answer
To Email:
Subject:
Note to go along with the question: (Optional, no
more than 1,000 characters)
int *a=new int[];
arrays and pointers are similar things .if you want to access any element just type a[element no] and access the element
Create Date
:
Saturday, March 15, 2008
Click here
to improve the Interview Question, Answer and other fields.