So I was programming C in one of the lessons and nothing is being printed to the console. Please help. Here is my code. No errors are coming up!
#include<stdio.h>
#include<string.h>
void copy(char* dst, char* src){
while(src != “\0”)
{
*dst = *src;
src++;
dst++;
}
*dst = 0;
}
int main(){
char srcString = “We promptly judged antique ivory buckles for the next prize!”;
int l = strlen(srcString);
char dstString[l];
char *srcPtr = &srcString[0];
char *dstPtr = &dstString[0];
copy(dstPtr, srcPtr);
dstPtr = &dstString[0];
for(int i = 0; i < strlen(dstString); i++)
{
printf(“%c”, *dstPtr);
dstPtr++;
}
}
7 posts - 2 participants