0
Why does the following code displays error???
#include<stdio.h> #include<conio.h> void main(){ int x[]={1,3,5,7,9}; clrscr(); y=x; y=y*2; printf("value is ℅d", *y); getch(); }
3 Antworten
+ 4
x is an array of 5 integers
and y is not even declared
change y=x; into int *y=&x;
+ 3
this works
removed clrscr() function
changed 'y=x;' to 'int* y=x;'
changed 'y=y*2;' to 'y=y+2;'
#include<stdio.h>
#include<conio.h>
int main(){
int x[]={1,3,5,7,9};
int* y=x;
y=y+2;
printf("value is %d", *y);
return 0;
}
0
ok wat if we add int y; as declaration statement....even then it is coming wrong.