I want to know how to convert, for example, the following string:
"Barack Obama" for "OBAMA, Barack".
That is, pro bibliographic format, type when citing authors of books / articles. But I want to know how to convert any name size to this format, it can be with 2 names (as in the example above) or with 3, 4, 5 ... n names, for example:
Lionel Andrés Blablabla Soccer Player Messi This name would look like this: MESSI, Lionel Andrés Blablabla Soccer Player.
I know how to convert if I know how many names the person's full name will have, but I want to know how to do this for any integer size, ie, not needing to know how many names the person has in the whole name. p>
Here is the code I've been able to do so far (it only works for whole names that have 6 names in total):
char nome[30][100];
int i, j;
for(i = 0; i < 6; i++)
scanf("%s", nome[i]);
for(j = 5; j > 4; j--)
printf("%s,", strupr(nome[j]));
for(i = 0; i <= 4; i++)
printf("%s ", nome[i]);