Write A Program to copy one String into Another and Count the number of Characters Copied

#include<stdio.h> #include<conio.h> void main ( ) { char str1 [80], str 2 [80]; int i ; printf (“enter a string ...

#include<stdio.h>
#include<conio.h>
void main ( )
{
char str1 [80], str 2 [80];
int i ;
printf (“enter a string \n”);
scanf (“%s” str 2);
for ( i =0; str 2[i]! = ‘\0’, i++)
str 1 [i] = str 2[i];
str 1 [i] = ‘\0’;
printf (“\n % s \n “ , str1);
printf (“number of characters = %d \n “ i);
getch();
}

Out Put:

enter a string computer 

computer 

number of characters = 8

Related

C Programs 6398395649930953636

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