Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR C

C Passing string to a Function

#include <stdio.h>
void displayString(char str[]);

int main()
{
    char str[50];
    printf("Enter string: ");
    fgets(str, sizeof(str), stdin);             
    displayString(str);     // Passing string to a function.    
    return 0;
}
void displayString(char str[])
{
    printf("String Output: ");
    puts(str);
}
 
PREVIOUS NEXT
Tagged: #C #Passing #string #Function
ADD COMMENT
Topic
Name
1+7 =