Write a program without using library functions ?



Write a program without using library functions ?

  • C Standard library functions or simply C Library functions are inbuilt functions in C programming.
  • The prototype and data definitions of the functions are present in their respective header files, and must be included in your program to access them.
  • If you want to use printf() function, the header file <stdio.h> should be included. For example,

Copy String Manually Without Using strcpy()

  • In this C Program we have to copy the string without using library functions.

Sample Code

#include <stdio.h>
int main()
{
    char str1[100], str2[100], j;

    printf("Enter the string str1: ");
    scanf("%s",str1);

    for(j = 0; str1[j] != '\0'; ++j)
    {
        str2[j] = str1[j];
    }

    str2[j] = '\0';
    printf("String str2: %s", str2);

    return 0;
}

Output

Enter the String str1: Wikitechy
String str2: Wikitechy

Related Searches to Write a program without using library functions.