Hello,
in onlinegdb this program works, but in codeblock the output is not correct - any idea?
Thank you very much!
The output in codeblock is with weird characters.
Code:
#include <stdio.h>
#include <stdlib.h>
int main()
{
char name[32];
char buffer[64];
char last[]= "passed the challenge!\n";
int ch, a;
printf("What is your name? ");
a=0;
while ((ch = getchar()) != '\n')
{
name[a] = ch;
a++;
if(a==31)
break;
}
strcpy(buffer,name);
strcat(buffer," ");
strcat(buffer,last);
a=0;
while(putchar(buffer[a++]))
;
return(0);