A
Army1987
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
char *_(char *str1, char *str2)
{
char *res;
res = malloc((strlen(str1)+strlen(str2))*sizeof(char));
strcpy(res, str1);
strcpy(res+strlen(str1), str2);
return res;
}
int main(void)
{
char a[] = "\nHey man look at me rockin' now\nI'm on the ";
char b[] = "Danny and Lisa";
char c[] = "\nThey take me away from";
char *d = _(_(a,"radio"),_(a,"video"));
char *e = _(d,_(" with ",b));
char *g = _("\nThe strangest places\nSweet ",b);
char *h = _(c,g);
char *i = _(_(h,c),_(h,c));
char *j = _(e,i);
char *k = _(_(d,j),_(j,e));
char *l = _(_(k,h),_(d,e));
puts(++l); /* ++l gets rid of the spurious newline character at the
beginning */
return 0;
}
Why does this program add a spurious '1' after each occurrence of the last
line of the chorus? (i.e. "I'm on the video with Danny and Lisa1").
(I said it was delirant... But I fear that for copyright problems I won't be
able to sumbit a modification of this to the next IOCCC...)
T.I.A.
--
#include <stdio.h>
main()
{
printf("\n\n--\nArmy1987");
}
#include <stdlib.h>
#include <stdio.h>
char *_(char *str1, char *str2)
{
char *res;
res = malloc((strlen(str1)+strlen(str2))*sizeof(char));
strcpy(res, str1);
strcpy(res+strlen(str1), str2);
return res;
}
int main(void)
{
char a[] = "\nHey man look at me rockin' now\nI'm on the ";
char b[] = "Danny and Lisa";
char c[] = "\nThey take me away from";
char *d = _(_(a,"radio"),_(a,"video"));
char *e = _(d,_(" with ",b));
char *g = _("\nThe strangest places\nSweet ",b);
char *h = _(c,g);
char *i = _(_(h,c),_(h,c));
char *j = _(e,i);
char *k = _(_(d,j),_(j,e));
char *l = _(_(k,h),_(d,e));
puts(++l); /* ++l gets rid of the spurious newline character at the
beginning */
return 0;
}
Why does this program add a spurious '1' after each occurrence of the last
line of the chorus? (i.e. "I'm on the video with Danny and Lisa1").
(I said it was delirant... But I fear that for copyright problems I won't be
able to sumbit a modification of this to the next IOCCC...)
T.I.A.
--
#include <stdio.h>
main()
{
printf("\n\n--\nArmy1987");
}