Created
November 25, 2023 11:29
-
-
Save EteimZ/8676b42925ea4a76bd5a12280deec071 to your computer and use it in GitHub Desktop.
Example program showing how to use the snprintf
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| int main() { | |
| // Create a buffer | |
| char helloBuffer[50]; | |
| // Using snprintf to create the "Hello, World" string | |
| snprintf(helloBuffer, sizeof(helloBuffer), "Hello, %s!\n", "World"); | |
| printf("%s", helloBuffer); | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment