Day#84 C' Coding Challenge

Day#84 C' Coding Challenge

Write a C program to concatenate two strings using pointers

---------------------------------------

#include <stdio.h>
#define FALSE 0

int main()
{

    char string1[10] = "Talent";
    char string2[10] = "Eve";
    char *ptr1 = string1;
    char *ptr2 = string2;

    while(*ptr1)   
    {
        ptr1++;    
    }
    
    while(*ptr2)   
    {
        *ptr1 = *ptr2;
        ptr2++;
        ptr1++;
    }

    printf("%s", string1);

    return FALSE;
}

Post a Comment

0 Comments