Home > OS >  C: print the longest common prefix
C: print the longest common prefix

Time:12-06

Beginner programmer here, trying to figure out how to find and print the longest common prefix in C.

I have a base here for the program.

#include <stdio.h>

void findprefix(char *str1, char *str2, char *found);

int main(void) {
    char str1[100];
    char str2[100];
    char found[10] = { '\0' }; 
    
    printf("\nGive string 1: ");
    scanf("           
  • Related