1. #include <stdio.h>
  2. int main() {
  3. char userName[100]; // Assuming the user's name will not exceed 100 characters
  4. printf("Enter your name: ");
  5. scanf("%99[^\n]", userName); // Read user input, limiting to 99 characters to leave room for null terminator
  6. printf("Hello, %s! Welcome to C programming.\n", userName);
  7. printf("Press any key to exit...\n");
  8. getchar(); // Waits for any key press
  9. return 0;
  10. }
 
 

90

Pasted Text #34518

This code snippet provides a basic interaction with the user, demonstrating how to handle input and output in a simple C console application.

PasteBin

Lines
13
Words
59
Size
443 bita
Created
Tipe
text/x-chdr
All Rights Reserved ((C))
Please log in to leave a comment!