A Little about the blog.....

This blog contains all the interview questions that i face during my interviews with various MNC's. I am trying to post the solutions for almost all the questions and i have covered few important topics which would be frequent topics in interviews. I hope the blog would be useful not only for the job aspirants but also to the one who tries to upgrade his/her knowledge in C and Embedded concepts......

please enter your mail address in the above mail address box to get the immediate updates of the new interview questions.....
Showing posts with label addresses. Show all posts
Showing posts with label addresses. Show all posts

Thursday, November 17, 2011

copying a string from one array to another array using pointers

#include"stdio.h"
#include"conio.h"
#include"string.h"
void main()
{
int i
;
char a[10],b[10];
char *p,*q;
clrscr();
printf("enter the string\t");
for(i=0;i<10;i++)
{
scanf("%c",&a[i]);
}
p=&a;
q=p;
for(i=0;i<10;i++)
{
b[i]=*q;
printf("%c",b[i]);
q++;
}
printf("\nthe values of p and q are %u,%u",p,q);
getch();
}