Skip to content

Instantly share code, notes, and snippets.

@EteimZ
Created November 25, 2023 11:29
Show Gist options
  • Select an option

  • Save EteimZ/8676b42925ea4a76bd5a12280deec071 to your computer and use it in GitHub Desktop.

Select an option

Save EteimZ/8676b42925ea4a76bd5a12280deec071 to your computer and use it in GitHub Desktop.
Example program showing how to use the snprintf
#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