Pointer with String in C Language part-4-c-ii
O LEVEL -PAPER 3rD -- M3-R4
C LANGUAGE
OBJECTIVES
Pointer Basics
Extended Concept of Pointer
Pointer's Arithmetic
1-Call by Reference with pointer
2-Pointer with Array
3-Pointer with String -a
APPLICATION OF POINTER
(check my previous post for above pointer chapter)
3- POINTER WITH STRING
WRITE A FUNCTION TO RETURN A STRING
![]() |
example of pointer in c |
OUTPUT
RETUPMOC
NOTE :- Remember this concept is useful for those who going to campus preparation or going to interview.. if you have any query please comments in comment section and if you like this please share.
Here for loop end with semi colon [for(l=o;*(p+1)!='\0';l++);]because we run the loop until it's value reached to null character i.e length of string ("computer") and second for loop
start with zero and end with l/2 i.e 8/2= 4[for(i=0;i<l/2;i++)] because we want to swap the character which total length is 8 so we run the loop half of it length and *(p+i) means value of C because as
we know that when ever asterisk come before pointer then it's indicate it's value of that block as
we saw in above example..
Comments
Post a Comment