Home

A program to explain how to pass a string to a function

C Programming Language 084

Program

#include <stdio.h>

void strings(char s1[]);
void main()
{
    char str1[30];

    printf("Enter string: ");
    gets(str1);
    strings(str1);

    printf("\n");
}

void strings(char s1[])
{
    puts(s1);
}

Result

Enter string: hello
hello


Last Updated on

Next Post: Rules vs Guidelines →

Comments