Question #290047

Write a C program to print the string and its length using functions


Expert's answer

#include <stdio.h>
#include <string.h>

int main() {
    char* str = "Hello, world!";

    printf("The string \"%s\" has length %d", str, strlen(str));

    return 0;
}
LATEST TUTORIALS
APPROVED BY CLIENTS