User Profile
Collapse
-
abhi17 started a topic int i=2; printf("%d %d",++i,++i); how can o/p be 4 4 with any order of evaluationin Cint i=2; printf("%d %d",++i,++i); how can o/p be 4 4 with any order of evaluation
this expression has undefined o/p but how could it give 4 4 pls suggest any possible mechanism by which 4 4 is produced -
scanf doubt
float f;
scanf("%d",&f);
scanf("%f",&f);
first use of scanf is wrong but why didnt the second one work?? howdoes one wrong scanf affects all other later uses of scanf -
abhi17 started a topic mat[i][j] = *(*(mat + i) + j) here mat is a pointer to an array of r elements anin Cmat[i][j] = *(*(mat + i) + j) here mat is a pointer to an array of r elements an
int mat[r][c];
mat[i][j] = *(*(mat+i) + j) ???
here mat is a pointer to an array of r elements and each elementof mat itself is an array of c elements
then in mat +i ,i gets scaled by c*sizeof(int) thus mat+i is starting address of ith row and then dereferencing it yields first element of ith row but looking at this expression it seems that *(mat + i) is also treated as a address
please help on understanding... -
abhi17 started a topic int arr[10]; //in file1.c extern int *arr; //in file2.c main() { arr[0]=1; } //in Cint arr[10]; //in file1.c extern int *arr; //in file2.c main() { arr[0]=1; } //
int arr[10]; //in file1.c
extern int *arr; //in file2.c
main()
{
arr[0]=1;
}
this code gave error saying undefined reference to arr, why??? -
int main(void) { func(); func(6); return 0; } int func(
int main(void)
{
func();
func(6);
return 0;
}
int func(int x)
{
printf("hello world");
}
why this code gave no error and printed hello world twice ???? -
f=++i||(k++)&&1; how are such expressions evaluated??
f=++i||(k++)&&1 ;
how are such expressions evaluated??
in my code this k never got incremented (i!=-1)
incremnt and decrement operators have higher precedence than && and || then shouldn't this mean that all these unary operators are evaluated in a logical expression
No activity results to display
Show More