how can i show ant text by onclick

#include <stdio.h>

void displayText() {
    printf("You clicked the button! This is the displayed text.\n");
}

int main() {
    printf("Click the button to display text.\n");

    // Simulating a button click
    displayText();

    return 0;
}

Explanation:

  1. #include <stdio.h>: Includes the standard input-output library for functions like printf.

  2. void displayText() {...}: Defines a function named displayText that doesn't take any arguments (void). Inside this function, it uses printf to display the text "You clicked the button! This is the displayed text.\n" to the console.

  3. int main() {...}: Defines the main function which serves as the entry point of the program.

  4. printf("Click the button to display text.\n");: Prints the initial message prompting the user to click the button.

  5. displayText();: Simulates a button click by calling the displayText function. In a real scenario, this would be connected to an actual button click event in a GUI or web application to display the text when the button is clicked.

  6. return 0;: Indicates successful completion of the main() function and the program as a whole.