Write a program for String copy using pointers

#include<stdio.h> #include<conio.h> void strcopy(char  * , char  * ); main() { char s[10], p[10]; printf(“enter a ...

#include<stdio.h>
#include<conio.h>
void strcopy(char *, char *);
main()
{
char s[10], p[10];
printf(“enter a string”);
gets(s);
strcopy(s, p);
puts(p);
getch();
}
void strcopy(char *s, char *p)
          {
            while (*s!=’\0’)
                        {
                        *p=*s;
                        p++, s++;
                        }
                        *p=’\0’;

            }

Related

Program for Sum of n numbers 1 + 2 + .... + n

# include<stdio.h> #include<conio.h> void main() { int n; printf ( “enter n value”); scanf ( "%d", & n); n = n * (n+1)/2; printf ( “\n sum of n natural numbers is %d", n );...

Write A Program for printing three numbers in ascending order

# include<stdio.h> #include<conio.h> main() { int a, b, c; printf (“enter a, b, c values”); scanf ("%d%d%d”, & a, & b, & c); if (a > b && a > c) { i...

Program to check whether the Given number is +ve or –ve using Ternary Operator

# include<stdio.h> #include<conio.h> main() { int a; printf (“enter a value”); scanf ("%d", & a); (a > 0)? printf (“given number is positive”) : printf (“given number i...

Post a Comment

emo-but-icon
:noprob:
:smile:
:shy:
:trope:
:sneered:
:happy:
:escort:
:rapt:
:love:
:heart:
:angry:
:hate:
:sad:
:sigh:
:disappointed:
:cry:
:fear:
:surprise:
:unbelieve:
:shit:
:like:
:dislike:
:clap:
:cuff:
:fist:
:ok:
:file:
:link:
:place:
:contact:

item