Search
 
SCRIPT & CODE EXAMPLE
 

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);
}
Comment

String as Parameter on C

void function(char arr[])
//void function(char *arr)
{
   arr[0] = 'X';
}        
int main()
{
   function("MyString");    
   return 0;
}
Comment

PREVIOUS NEXT
Code Example
C :: c for loop 
C :: accessing elements of 1d array using pointers 
C :: limit axis in one direction plt 
C :: implicit declaration of function ‘usleep’ [-Wimplicit-function-declaration] 
C :: C Program to Find Largest and Smallest Number among N 
C :: pyramid using c 
C :: initialize array c 
C :: double array in c 
C :: celsius to fahrenheit formula 
C :: addition of two numbers in c 
C :: struct main function c in unix 
C :: c functions example 
C :: volatile keyword in c 
C :: C (ANSI) 
C :: enregistrement en c 
C :: binary search tree of strings in c 
C :: continue statement in c 
C :: passing file as argument in c 
C :: best approach c menu terminal 
C :: argparse allow line break 
C :: text to hex in C 
C :: binary sorting 
C :: C special character display 
C :: pointer c 
C :: c read file from command line 
C :: arduino internal pull up resistor 
C :: https://www.tiktok.com/@kaiwan.99/video/7115521325766069510?is_from_webapp=1&sender_device=pc&web_id=7083069815002449410 
C :: install lib juicyPixel in haskell 
C :: FILE* fptr = fopen("test", "r"); if (__ (fptr)) { printf("End of file reached"). (42); } 
C :: arma 3 key pressed 
ADD CONTENT
Topic
Content
Source link
Name
6+5 =