I am studying C as of now and I am stuck on this question.
Input: 'abc'
Output: 'aabbcc'
I am stuck with the pointers and increasing the size buffer. See below
Edit: added the main()
#include <stdio.h>
#include <string.h>
int main()
{
char destValue[];
char srcValue[];
//User input
printf("Please enter valid text: " );
scanf("%s", srcValue);
//Copying to memory
memcpy(destValue, srcValue, strlen(srcValue)+1);
char lenghtOfText = strlen(srcValue);
for(int i = 0; i < lenghtOfText; i++) {
tempValue[i] = strcat(tempValue, srcValue);
}
}
Every time I am running my code, it keeps on failing and the error message is Abort 6. Upon searching, they said the tempValue does not increase the size of the buffer.
Sorry, if my code isn't working and I am just learning C programming. Thanks for understanding