Hi guys can you please help me with this. All I need to do is input a number and display the corresponding alphabet.For example 2 then the output should be A B.. I am working on a code but my problem is the output is displaying together with a special character. Can you help me do it pls. Thanks in advance!
#include<stdio.h>
#include<stdlib.h>
#include<conio.h>
int main()
{
int num;
char *buffer;
printf("How long is the string:");
scanf("%s",&num);
buffer=(char *) malloc(num);
if (buffer==NULL) exit(1);
for(int i=0;i<num;i++)
{
for (int j=0;j<i;j++)
buffer[j]=(i%26)+'A';
printf("The strings are: %s \n",buffer);
getch();
free(buffer);
}
return 0;
}