Help me in solving CLB027 problem

My issue

char and char both are different or same?

My code

#include <stdio.h>

int main(void) {
	char  a,b;
	a="Code";
	b="Chef";
	printf("%c%c",a,b);
	return 0;
}


Learning course: Learn C
Problem Link: CodeChef: Practical coding for everyone

A char array is different than char.

When you write

char a,b;

You can only write one letter in it.

If you write a char array, you can write up to 10^7 letters in it.

Solution:

#include <stdio.h>

int main(void) {
	char a[] = "Code";
	char b[] = "Chef";
	printf("%s%s",a,b);
	return 0;
}

include <stdio.h>

int main(void) {

char a[]="Code";
char b[]="Chef";
printf("%s%s",a,b);
return 0;

}
here is the right way to do this.

Thats a crazy lot of letters! I did not know this!

1 Like