#include <stdio.h>
#include <stdlib.h>
#include <string.h>
void last_link(char* link, int char_count, char* last_chars){
int calcLink = linkSize - char_count;
if (calcLink < 0) calcLink = 0;
memcpy(last_chars
, link
+ calcLink
, char_count
); last_chars[char_count] = '\0';
}
int main() {
char link[100];
//lê o tamanho da string pra capturar os últimos caracteres
char last_chars[12];
last_link(link, 11, last_chars);
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxzdGRsaWIuaD4KI2luY2x1ZGUgPHN0cmluZy5oPgoKdm9pZCBsYXN0X2xpbmsoY2hhciogbGluaywgaW50IGNoYXJfY291bnQsIGNoYXIqIGxhc3RfY2hhcnMpewogICAgaW50IGxpbmtTaXplID0gc3RybGVuKGxpbmspOwogICAgaW50IGNhbGNMaW5rID0gbGlua1NpemUgLSBjaGFyX2NvdW50OwoJaWYgKGNhbGNMaW5rIDwgMCkgY2FsY0xpbmsgPSAwOwoKCW1lbWNweShsYXN0X2NoYXJzLCBsaW5rICsgY2FsY0xpbmssIGNoYXJfY291bnQpOwoJbGFzdF9jaGFyc1tjaGFyX2NvdW50XSA9ICdcMCc7Cn0KCmludCBtYWluKCkgewoJY2hhciBsaW5rWzEwMF07CgoKCXNjYW5mKCIlcyIsIGxpbmspOwoJLy9sw6ogbyB0YW1hbmhvIGRhIHN0cmluZyBwcmEgY2FwdHVyYXIgb3Mgw7psdGltb3MgY2FyYWN0ZXJlcwoJcHJpbnRmKCJcblRhbWFuaG8gZGEgU3RyaW5nOiAlaVxuIiwgc3RybGVuKGxpbmspKTsKCgljaGFyIGxhc3RfY2hhcnNbMTJdOwoJbGFzdF9saW5rKGxpbmssIDExLCBsYXN0X2NoYXJzKTsKCglwcmludGYoIiVzXG4iLCBsYXN0X2NoYXJzKTsKCglyZXR1cm4gMDsKfQ==