Quantcast
Channel: C - Codecademy Forums
Viewing all articles
Browse latest Browse all 25

String copier project help

$
0
0

I am trying to write the code for the “String Copier” project (link to the project

)
that comes with the C lesson on pointers.
I don’t understand what’s wrong with my code.
It outputs a bunch of error messages which I don’t understand. Could you help?

#include<stdio.h>
#include<string.h>
 
void copy(char* dst, char* src){
  while(*src != '\0'){
    strcpy(*dst,*src);
    src++;
    dst++;
  }
  *dst= '\0';
}
int main(){
  char srcString[] = "We promptly judged antique ivory buckles for the next prize!";
  int len= strlen(srcString) + 1;
  
  char dstString[len]{
    strcpy(*dstString,*srcString);
    printf("%s",dstString);

  }
}

4 posts - 4 participants

Read full topic


Viewing all articles
Browse latest Browse all 25

Latest Images

Trending Articles


Telangana Ration Card Online Status Ahara Bhadratha Card Online Status


Students hit streets to save Agriculture College land in city


Waves Complete v2019.02.14 Incl Emulator-R2R


CalCen


[RELEASE THREAD]--_A-Team_--Cricket_Dream_5G


New! K-12 Display Bulletin Boards for Grade 5 (1st Quarter)


HI-FI SET - PASADENA PARK


Police blotter for Jan. 12


WordPress: Reverse Shell


Artbeats - Nature: Grow! (HD + SD)



Latest Images