How the " char *atr "-works,what is it working principle and and explain the code ,why this makes a answer " fg " ?. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How the " char *atr "-works,what is it working principle and and explain the code ,why this makes a answer " fg " ?.

char *atr; char srr[]={"abcdefg"}; tr=srr; atr+=5; cout<<atr<<\n;

14th Aug 2020, 5:56 PM
ILLUMINATIE
ILLUMINATIE - avatar
1 Answer
+ 1
char *atr; // charecter pointer char str[] = "abcdefg" ; //charecter array assigned with sequence of letters.. atr = str ; // now both point to the same charecter sequence.. atr = atr + 5; now atr pointer is advanced to 5 charecter locations further in sequence so now it points to "fg" "abcdefg" 012345 cout <<atr; output fg.
14th Aug 2020, 6:29 PM
Jayakrishna 🇮🇳