Month: May 2017

20
May
2017

Void Pointer and Typecasting in Pointer

code: #include<stdio.h> int main() { void *vp; int x=100; vp=&x; //printf(“%d\n”,*vp); //it will give error because it’s…

20
May
2017

Pointer Basic Clear to Clearer with Increment

code: #include<stdio.h> int main() { int x[]={10,20,30}; int *p; p=&x; int k; k=*p; printf(“%d\n”,k); k=++(*p); printf(“%d\n”,k); k=*p++;…

19
May
2017

Char Pointer Practical Example Using String Input and String/Char Variable Passing

code: #include<stdio.h> void toggleChar(char *sptr){ int i; for(i=0;*(sptr+i)!=’\0′;i++) { if(*(sptr+i)>=’a’ && *(sptr+i)<=’z’) *(sptr+i)=*(sptr+i)-32; else if(*(sptr+i)>=’A’&& sptr[i]<=’Z’) *(sptr+i)=*(sptr+i)+32;…

19
May
2017

Send Array to Function Using Pointer

code: #include<stdio.h> void printArray(int *p_array,int n) { int i; printf(“Content of the array: “); for(i=0; i<n; i++)…

19
May
2017

Relationship Between 1D array and pointer

code: #include<stdio.h> int main() { int i; int x[]= {10,20,30,40,50}; printf(“%p %p\n”,x+1,&x[1]); //base address is always pointing…

19
May
2017

Return More Than one Value in a Function

In function we can’t retun more than one value with return keyword. In this case we need pointer…