// // Ask the user to enter their firstName & print it back to them
// #include <stdio.h>
// void printString(char arr[]);
// int main(){
// char firstName[50];
// scanf("%s",firstName);
// printf("Your name is %s",firstName);
// return 0;
// }
// void printString(char arr[]){
// for(int i=0; arr[i] !='\0' ;i++){
// printf("%c",arr[i]);
// }
// printf("\n");
// }
//----------------------------
// same code in different way
#include <stdio.h>
void printString(char arr[]);
int main(){
char name[50];
scanf("%s",name);
printf("Your name is %s",name);
return 0;
}
void printString(char arr[]){
for(int i=0; arr[i] !='\0' ;i++){
printf("%c",arr[i]);
}
printf("\n");
}
To embed this project on your website, copy the following code and paste it into your website's HTML: