Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdlib.h>
- #include <stdio.h>
- #define ARR_LEN 6
- int main() {
- char buff[ARR_LEN];
- int i;
- for(i=0; i<ARR_LEN; i++){
- buff[i] = i + '0';
- }
- snprintf(buff, ARR_LEN, "012345");
- puts(buff);
- }
- buffersnprintf.c: In function ‘main’:
- buffersnprintf.c:10:32: warning: ‘snprintf’ output truncated before the last format character [-Wformat-truncation=]
- snprintf(buff, ARR_LEN, "012345");
- ^
- buffersnprintf.c:10:1: note: ‘snprintf’ output 7 bytes into a destination of size 6
- snprintf(buff, ARR_LEN, "012345");
- ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement