Can a blank struct b declared
· Can an array of blank struct b declared
· If yes what does a[3] point to
User Profile
Collapse
-
pointer array
Code:char *s="george"; printf(" from s %s\n",s); s[0]='k'; printf(" from new s %s\n",s); char p[]="john"; printf("from p %s\n",p); p[2]='k'; printf(" from new p %s\n",p);
plss explain me how dis actually works inside the memory?
1)s is just a pointer holding... -
im still confused...in both cases it was call by value...so den it shud nt reflect the changes...but in the second case its reflecting it(the 's' was neymar messi and not 'nekmar messi') -
C pointers with char array
Code:void func(char *s) { s+=1; } void main() { char s[]="neymar messi"; func(s); printf("%s",s); }
but its showing 's' as it is...y?
But in this case the output is nekmar messi....
Code:void func(char *s) { s[2]='k'; } void main() {
No activity results to display
Show More
Leave a comment: